----- Original Message ----- > From: "Brian Goetz" <brian.go...@oracle.com> > To: "Remi Forax" <fo...@univ-mlv.fr> > Cc: "Jim Laskey" <james.las...@oracle.com>, "amber-spec-experts" > <amber-spec-experts@openjdk.java.net> > Sent: Vendredi 29 Octobre 2021 20:26:28 > Subject: Re: [External] : Re: Are templated string embedded expressions > "method parameters" or "lambdas"?
>> Do we really need to support the second case at all ? > > Yes :) > >> Instead of >> "Hello \{name()}" >> >> it can be written to something like >> () -> F."Hello \{name()}" > > That deprives your callee of the opportunity to choose the formatter for > you. Whoops, now the feature is way less expressive. One of the goals > here is to enable APIs to accept TSs as parameters, and be in control of > the when and how of formatting. If you want the API to choose the formatter, you can take it as parameter like a normal lambda formatter -> formatter."Hello \{name()}" You do not need to provide an access to a TemplateString explicitly in the language because you can have a TemplatePolicy identity that returns the one taken as argument. > >> >> I think the choice between eager and lazy should be reflected in the syntax, > > Oh great, two subtly different sets of semantics. Way to overspend the > complexity budget. I don't understand, those expressions, lambdas and method references already exist in Java. Rémi