it2-bootstrap: eval/operate glitch

Brian Goetz brian.goetz at oracle.com
Fri Aug 10 08:02:08 PDT 2012


Yes, this is an oversight.  All XxxOperator SAMs were supposed to use 
"operate" as their method name.

The rule we're following is: for a given arity, each SAM method should 
have a unique name.  This allows us to use default methods to implement 
more than one SAM.  For example:

interface Combiner<T,U,V> {
     V combine(T t, U u);
}

interface BinaryOperator<T> implements Combiner<T,T,T> {
     T operate(T t1, T t2);

     T combine(T t1, T t2) default { return operate(t1, t2); }
}



On 8/10/2012 7:00 AM, Aleksey Shipilev wrote:
> Hi,
>
> I'm migrating some of my code to fit it2-bootstrap API, and I think the
> method names are inconsistent:
>
>         BinaryOperator.operate
>          UnaryOperator.operate
>      IntBinaryOperator.eval
>       IntUnaryOperator.operate
>   DoubleBinaryOperator.eval
>    DoubleUnaryOperator.operate
>     LongBinaryOperator.eval
>      LongUnaryOperator.operate
>
> Should we settle on "operate"?
>
> -Aleksey.
>


More information about the lambda-dev mailing list