Re: String Tapas Redux: Beyond mere string interpolation

2021-09-17 Thread John Rose
On Sep 17, 2021, at 3:49 AM, Tagir Valeev mailto:amae...@gmail.com>> wrote: Another alternative is to have a single list of template fragments, something like this: Probably the VM will prefer to see a single string. There are lots of unused Unicode points that can serve as segment markers. Thi

Re: String Tapas Redux: Beyond mere string interpolation

2021-09-17 Thread Remi Forax
- Original Message - > From: "Tagir Valeev" > To: "Jim Laskey" > Cc: "amber-spec-experts" > Sent: Vendredi 17 Septembre 2021 12:49:30 > Subject: Re: String Tapas Redux: Beyond mere string interpolation > It's interesting that

Re: String Tapas Redux: Beyond mere string interpolation

2021-09-17 Thread Remi Forax
- Original Message - > From: "John Rose" > To: "Jim Laskey" > Cc: "amber-spec-experts" > Sent: Vendredi 17 Septembre 2021 08:43:29 > Subject: Re: String Tapas Redux: Beyond mere string interpolation > Yay! > > I agree with Brian’

Re: String Tapas Redux: Beyond mere string interpolation

2021-09-17 Thread Brian Goetz
We went back and forth a few times on this, and might go back and forth some more.  For many applications, the segments are valuable, though for some, the full string is more useful. Whether the framework or the policy object does String::split isn't really that interesting; the real question

Re: [External] : Re: String Tapas Redux: Beyond mere string interpolation

2021-09-17 Thread Jim Laskey
Agree. Most of the time fragments are what are required. There are also circumstances where having the full string is also useful. As you point, in the doc, we discuss localization, where we use the interpolation string with placeholders as the key to a "ResourceBundle" lookup. During evaluatio

Re: String Tapas Redux: Beyond mere string interpolation

2021-09-17 Thread Tagir Valeev
It's interesting that in both Scala and JavaScript when you define custom interpolation policy, you get a collection of Strings instead of a single string. So in the article, we see "error: file \{} not found" but in Scala/JS you would get List.of("error: file ", " not found")). While for localizat

Re: String Tapas Redux: Beyond mere string interpolation

2021-09-17 Thread Tagir Valeev
As for custom template processing in JavaScript, see "Tagged templates" section here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals On Fri, Sep 17, 2021 at 2:15 PM Tagir Valeev wrote: > > Btw people say that Scala provides a similar mechanism using > StringCo

Re: String Tapas Redux: Beyond mere string interpolation

2021-09-17 Thread Tagir Valeev
Btw people say that Scala provides a similar mechanism using StringContext class: https://www.scala-lang.org/api/2.12.2/scala/StringContext.html In fact, Scala's `s` prefix before interpolated literal is a recipe for interpolation provided by a standard library, not by language. And it's possible t

Re: String Tapas Redux: Beyond mere string interpolation

2021-09-16 Thread John Rose
Yay! I agree with Brian’s response to Remi: Nothing new here regarding eval or ASTs. My favorite wished-for-use-case for templated strings is a grammar where the “holes” are grammar actions or other configuration points for rules. This paper made me envious for the sake of Java, and also made m

Re: String Tapas Redux: Beyond mere string interpolation

2021-09-16 Thread Tagir Valeev
Hello! Just read the proposal. I don't have any useful comments for now. For me, the proposal looks great as is. Go ahead and implement it :D With best regards, Tagir Valeev. On Thu, Sep 16, 2021 at 8:28 PM Jim Laskey wrote: > > Amber experts, > > Now that JDK 17 has been plated and left the ki

Re: String Tapas Redux: Beyond mere string interpolation

2021-09-16 Thread Brian Goetz
macro *From: *"Jim Laskey" *To: *"amber-spec-experts" *Sent: *Jeudi 16 Septembre 2021 15:28:41 *Subject: *String Tapas Redux: Beyond mere string interpolation Amber experts, Now tha

Re: String Tapas Redux: Beyond mere string interpolation

2021-09-16 Thread Remi Forax
bad thing. Rémi [1] https://en.wikipedia.org/wiki/Hygienic_macro > From: "Jim Laskey" > To: "amber-spec-experts" > Sent: Jeudi 16 Septembre 2021 15:28:41 > Subject: String Tapas Redux: Beyond mere string interpolation > Amber experts, > Now that JDK 1

String Tapas Redux: Beyond mere string interpolation

2021-09-16 Thread Jim Laskey
Amber experts, Now that JDK 17 has been plated and left the kitchen, we should have a look-see at one of the new menu items Brian and I have had on a slow boil for these last few months; Templated Strings. Before you start shouting out, "Templated Strings? This isn't what I ordered! The subjec