> From: "John Rose" <[email protected]> > To: "Tagir Valeev" <[email protected]> > Cc: "Brian Goetz" <[email protected]>, "amber-spec-experts" > <[email protected]> > 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:[email protected] | > [email protected] ] > 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
