> From: "John Rose" <john.r.r...@oracle.com> > To: "Tagir Valeev" <amae...@gmail.com> > Cc: "Brian Goetz" <brian.go...@oracle.com>, "amber-spec-experts" > <amber-spec-experts@openjdk.java.net> > Sent: Samedi 31 Juillet 2021 20:00:20 > Subject: Re: Minor improvement to anonymous classes
> On Jul 30, 2021, at 8:55 PM, Tagir Valeev < [ mailto:amae...@gmail.com | > amae...@gmail.com ] > wrote: >> 2. Allow new {...} instead of new Object() {…}. > I would think *that* would make a very useful poly expression. > Building “new Object() {…}” has far fewer use cases than > “build me an object of the type the context requires, with > these methods”. > My overall reaction to the extra syntax tweaks to the > existing AIC syntax is, “meh”. The syntax is inherently > ceremonious; why trouble to elide an extra token at > the head? and i would prefer to keep that syntax available if at some point in the future we decide to allow classes (or perhaps just record) to be initialized in a literal way. record Person(String name, int age) {} var person = new Person { name = "Ana", age = 31 }; Person person = new { name = "Ana", age = 31 }; which is more readable once you starts to have more than 3 or 4 components (and avoid builders). Rémi