[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-lambda-dev
Subject:    More Readable Use Site extension Methods for java
From:       serge.boulay () gmail ! com (Serge Boulay)
Date:       2010-12-13 13:42:54
Message-ID: AANLkTi=XRoFu+B-HnhQ43s9sudanPe9zA9vJbBZhdhgu () mail ! gmail ! com
[Download RAW message or body]

agree, and most of us who have worked with the .net platform have come to
love this feature.

On Tue, Dec 7, 2010 at 10:42 AM, Llewellyn Falco <isidore at setgame.com>wrote:

> >
> >
>
> 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.)
> >
> >
> Extension methods as stated ALREADY exist. the only difference is that they
> can be applied after the "." which effects readability.
>
> Let me restate this. The only argument here is READABILITY.
>
> i have a blog about this here:
> http://llewellynfalco.blogspot.com/2010/09/extension-methods.html
>
> These type of methods aren't actually part of the object. It is just syntax
> to allow for readability. They don't give or takeaway any power from the
> "creator" of the object.
>
> As for readability, here's an example of  the difference between the
> current
> "reverse polish" notation enforced and the ability to write after the "."
>
> Current
> dividedBy(minus(times(add(1,2)3),1)4)
>
> Make sense?
> Easy to read?
>
> let's try after the "."
>
> 1.plus(2).times(3).minus(1).dividedBy(4)
>
>
>
> I believe there is a strong case that is more readable.
>
> llewellyn
>
>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic