> De: "Kevin Bourrillion" <kev...@google.com> > À: "Remi Forax" <fo...@univ-mlv.fr> > Cc: "daniel smith" <daniel.sm...@oracle.com>, "amber-spec-experts" > <amber-spec-experts@openjdk.java.net> > Envoyé: Mardi 9 Octobre 2018 21:39:07 > Objet: Re: New JEP: Concise Method Bodies
> On Tue, Oct 9, 2018 at 12:34 PM < [ mailto:fo...@univ-mlv.fr | > fo...@univ-mlv.fr > ] > wrote: >>> I do like that feature, but, aren't statics the only things that are already >>> easy to make lazy (holder class)? >>> This pattern should already be evangelized heavily today for anyone with >>> Java 8 >>> and up. >> The holder class is a great pattern until you have a better one (sorry just >> kidding). > I hope you're not kidding because I agree with you 100%. :-) the kidding was on the word "better" because if you have some side effect, you clearly should not use the lazy static final. > This has become a tangent of a tangent. My only purpose was to make clear that > the value of implement-Comparable-by-delegating-to-Comparator idiom is already > here and real today as of Java 8, not something that will only become a good > pattern contingent on new features. The new features will just make it even, > as > you say, better. this also remember me that if the lambda proxies are value types at runtime, we may not need any static field at all, because no allocation is really needed. Rémi >>> On Tue, Oct 9, 2018 at 11:50 AM < [ mailto:fo...@univ-mlv.fr | >>> fo...@univ-mlv.fr >>> ] > wrote: >>>>> De: "Kevin Bourrillion" < [ mailto:kev...@google.com | kev...@google.com >>>>> ] > >>>>> À: "daniel smith" < [ mailto:daniel.sm...@oracle.com | >>>>> daniel.sm...@oracle.com ] >>>>> > >>>>> Cc: "Remi Forax" < [ mailto:fo...@univ-mlv.fr | fo...@univ-mlv.fr ] >, >>>>> "amber-spec-experts" < [ mailto:amber-spec-experts@openjdk.java.net | >>>>> amber-spec-experts@openjdk.java.net ] > >>>>> Envoyé: Mardi 9 Octobre 2018 20:48:10 >>>>> Objet: Re: New JEP: Concise Method Bodies >>>>> On Tue, Oct 9, 2018 at 11:43 AM Dan Smith < [ >>>>> mailto:daniel.sm...@oracle.com | >>>>> daniel.sm...@oracle.com ] > wrote: >>>>>> We have a rich API for building Comparators. I would expect most >>>>>> non-legacy >>>>>> implementations of Comparable to implement their 'compareTo' method by >>>>>> delegating to a Comparator. >>>>> +100 >>>>> To me, this pattern is the strongest use case for the entire feature. >>>> We need the lazy static final feature too. >>>> Rémi >>> -- >>> Kevin Bourrillion | Java Librarian | Google, Inc. | [ >>> mailto:kev...@google.com | >>> kev...@google.com ] > -- > Kevin Bourrillion | Java Librarian | Google, Inc. | [ > mailto:kev...@google.com | > kev...@google.com ]