Re: New JEP: Concise Method Bodies

2018-09-20 Thread Tagir Valeev
Hello, Kevin! Yes, it's a little bit hard to migrate between block body - expression body - method reference. However we already have this problem in lambdas, and we are living with this without much hassle. That's because every decent IDE can convert between these forms for you. Btw IDEA has an

Re: JEP draft: Concise Method Bodies - extend this to local functions?

2018-09-20 Thread Brian Goetz
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), Yes, unqualified method references have been on our radar since Java 8, and yes, we know that local methods

Re: JEP draft: Concise Method Bodies - extend this to local functions?

2018-09-20 Thread Alex Buckley
On 9/20/2018 2:16 PM, Remi Forax wrote: yes, but in your example the return type is not the same, i prefer mine class Utils { Function fun() = this::bar; Function fun2() -> this::bar; Function bar() { return null; } String bar(String s) { return null; } } Yes, it's

Re: JEP draft: Concise Method Bodies - extend this to local functions?

2018-09-20 Thread Remi Forax
- Mail original - > De: "Maurizio Cimadamore" > À: "Alex Buckley" , "amber-spec-experts" > > Envoyé: Jeudi 20 Septembre 2018 22:28:42 > Objet: Re: JEP draft: Concise Method Bodies - extend this to local functions? > On 20/09/18 21:22, Alex Buckley wrote: >> On 9/20/2018 1:08 PM,

Re: JEP draft: Concise Method Bodies - extend this to local functions?

2018-09-20 Thread Alex Buckley
On 9/20/2018 1:28 PM, Maurizio Cimadamore wrote: Function fun() = Utils::bar; Function fun = Utils::bar; (first is method body, second is variable initializer) I think Remi is noting the fact that, when using `->`, the single expression can be a method reference expression. I have already

Re: New JEP: Concise Method Bodies

2018-09-20 Thread Alex Buckley
On 9/20/2018 12:05 PM, Kevin Bourrillion wrote: In this case, I think the `=/` /form /might/ also clear that bar because of the automatic parameter pass-through. But I cannot currently see how the `->` form comes close to clearing it. (Data welcome.) Ooh, you know the magic words! Okay,

Re: New JEP: Concise Method Bodies

2018-09-20 Thread Maurizio Cimadamore
On 20/09/18 20:05, Kevin Bourrillion wrote: In this case, I think the `=/` /form /might/ also clear that bar because of the automatic parameter pass-through. But I cannot currently see how the `->` form comes close to clearing it. Not sure I get it - surely every getter might benefit form

Re: JEP draft: Concise Method Bodies - extend this to local functions?

2018-09-20 Thread Maurizio Cimadamore
On 20/09/18 17:32, Remi Forax wrote: There is also a potential confusion between   Function fun() = Utils::bar; and   Function fun() -> Utils::bar; You meant between Function fun() = Utils::bar; and Function fun = Utils::bar; ? (first is method body, second is variable initializer)

Re: New JEP: Concise Method Bodies

2018-09-20 Thread Kevin Bourrillion
On Wed, Sep 19, 2018 at 2:44 PM Alex Buckley wrote: On 9/19/2018 12:31 PM, Kevin Bourrillion wrote: > > In other cases, it looks like you're gaining a very /small/ amount of > > syntactic conciseness (mostly omitting `return`) and not much else? Is > > there any actual /conceptual/ simplicity or

Re: JEP draft: Concise Method Bodies - extend this to local functions?

2018-09-20 Thread Remi Forax
> De: "John Rose" > À: "Brian Goetz" > Cc: "amber-spec-experts" > 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.go...@oracle.com | > brian.go...@oracle.com ] >

Re: JEP draft: Concise Method Bodies - extend this to local functions?

2018-09-20 Thread Remi Forax
> De: "John Rose" > À: "Brian Goetz" > Cc: "amber-spec-experts" > 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.go...@oracle.com | > brian.go...@oracle.com ] >

Re: JEP draft: Concise Method Bodies - extend this to local functions?

2018-09-20 Thread John Rose
On Sep 19, 2018, at 6:23 PM, Brian Goetz 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? …")