More Readable Use Site extension Methods for java

Ali Ebrahimi ali.ebrahimi1781 at
Mon Dec 6 20:55:28 PST 2010

Hi Brian,

On Mon, Dec 6, 2010 at 11:22 PM, Brian Goetz <brian.goetz at> wrote:

> I propose to have use site and declaration site extension methods.
> I totally understand why you would want this; there have been plenty of
> times I would have enjoyed having this tool in the toolbox too.
> However, we remain opposed to use-site extension methods because we believe
> that the author of an API should remain in control of their API.  Allowing
> users to monkey-patch in new functionality to existing types undermines this
> demarcation of responsibility.
> (A further problem with use-site extension methods is the lack of
> reflective discovery.  Consumers of classfiles (such as non-Java compilers
> like JRuby, as well as templating mechanism such as JSP EL) cannot easily
> find these extension methods.)
My proposed scheme is a compile time trick and don't emitted any info in
byte code. As sample:{f -> f.isReal()}) transforms to,#{f -> f.isReal()})

In this case compiler instead of compile time error(compiler can not find
Symbol select in List)
searches in static imports for appropriate method and if find one result
then transformation can be done.

Best Regards

Ali Ebrahimi

More information about the lambda-dev mailing list