Bikeshed: what do we call the distinguished method of a SAM?

Brian Goetz brian.goetz at oracle.com
Tue Jul 2 15:26:10 PDT 2013


Yeah, that seems better.

On 7/2/2013 4:52 PM, Kevin Bourrillion wrote:
> I wonder if "functional method" says just as much?
>
>
> On Tue, Jul 2, 2013 at 1:31 PM, Sam Pullara <spullara at gmail.com
> <mailto:spullara at gmail.com>> wrote:
>
>     Looks good to me.
>
>     Sam
>
>     On Jul 2, 2013, at 12:55 PM, Brian Goetz <brian.goetz at oracle.com
>     <mailto:brian.goetz at oracle.com>> wrote:
>
>      > How about:
>      >
>      >     * <p>This is a <a href="package-summary.html">functional
>     interface</a>
>      >     * whose functional abstract method is {@link #apply(Object)}.
>      >
>      > where this is defined in package info:
>      >
>      > * <em>Functional interfaces</em> provide target types for lambda
>     expressions
>      > * and method references.  Each functional interface has a single
>     abstract method,
>      > * called the <em>functional abstract method</em> for that
>     functional interface,
>      > * to which the lambda expression's parameter and return types are
>     matched or
>      > * adapted.  Functional interfaces can provide a target type in
>     multiple contexts,
>      > * such as assignment context, method invocation, or cast context:
>      >
>      >
>      > On 7/2/2013 3:44 PM, Brian Goetz wrote:
>      >> Working on the spec for the SAMs.  In consultation with Doug,
>     converging
>      >> on a style that casts a SAM as *representing* an abstract entity
>     such as
>      >> a function or operation, and treating the SAM *as if* it were that
>      >> function.  For example:
>      >>
>      >> /**
>      >>  * Represents a function that accepts one argument and produces
>     a result.
>      >>  *
>      >>  * @param <T> the type of the input to the function
>      >>  * @param <R> the type of the result of the function
>      >>  *
>      >>  * @since 1.8
>      >>  */
>      >> @FunctionalInterface
>      >> public interface Function<T, R> {
>      >>
>      >>     /**
>      >>      * Applies this function to an argument.
>      >>      *
>      >>      * @param t the function argument
>      >>      * @return the function result
>      >>      */
>      >>     R apply(T t);
>      >>
>      >> I think one thing that is missing is tying together the sole SAM
>     method
>      >> with the SAM class.  This is obvious in a SAM with no default or
>     static
>      >> methods (and no methods from Object), but starts to get lost in the
>      >> noise as the method count adds up.
>      >>
>      >> I'm thinking of something like:
>      >>
>      >>  * This is a <a href="...">functional interface</a> whose _____
>     method
>      >> is {@link #apply}.
>      >>
>      >> For some value of ____.  What do we call the primary SAM method?
>       The
>      >> implementation method?  The primary SAM method?  The abstract
>     method?
>      >>
>
>
>
>
> --
> Kevin Bourrillion | Java Librarian | Google, Inc. |kevinb at google.com
> <mailto:kevinb at google.com>


More information about the lambda-libs-spec-experts mailing list