JEP draft: Concise Method Bodies - extend this to local functions?
forax at univ-mlv.fr
Thu Sep 20 16:32:28 UTC 2018
> De: "John Rose" <john.r.rose at oracle.com>
> À: "Brian Goetz" <brian.goetz at oracle.com>
> Cc: "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
> Envoyé: Jeudi 20 Septembre 2018 15:40:19
> Objet: Re: JEP draft: Concise Method Bodies - extend this to local functions?
> On Sep 19, 2018, at 6:23 PM, Brian Goetz < [ mailto:brian.goetz at oracle.com |
> brian.goetz at oracle.com ] > wrote:
>> I think there’s more immediate payback in doing the more constrained feature of
>> concise method bodies first.
> Also, local functions seem inevitably to expand into mutually recursive groups
> of locals.
> ("Why can't I do factorial? …")
> There are some design ideas for all that, but it's complicated enough on its own
> that it
> has to be done on its own or as part of a larger project.
> And FTR I am very enthusiastic about CMB's: They are a decisive improvement
> in Java's ability to do software reuse at method granularity. They include both
> static and dynamic delegation as special cases, which are patterns Java hasn't
> been so good at to date. I remember proposals for first-class delegation support
> in the past, and CMB's subsume those, IMO.
And explicit delegations is far better than implicit delegation as Kotlin does,
but while i find the single expression form useful, the method reference form is very similar to the syntax that was once proposed for default methods and i still find this syntax ugly.
There is also a potential confusion between
Function<A,B> fun() = Utils::bar;
Function<A,B> fun() -> Utils::bar;
> — John
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the amber-spec-experts