JEP draft: Concise Method Bodies - extend this to local functions?
Remi Forax
forax at univ-mlv.fr
Thu Sep 20 16:18:16 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.
> +1
> 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.
There is also have an issue with method references because a local function has no owner type (from the Java POV, obviously there is an owner class once desugared by the compiler),
class A {
static void foo() { }
static void m() {
void foo() { }
A::foo // ok
A.m::foo or ::foo ??
}
}
One solution is to allow ::foo, which first, look for a local method, the a static method and then a method method imported by an import static.
> — John
Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20180920/ceedc109/attachment.html>
More information about the amber-spec-experts
mailing list