Re:JEP 430: String Templates (Preview) Proposed to Target Ja...
by Kwpolska on Friday March 03, 2023 @05:12PM
(#35015754)
Swift’s choice is strange and ugly IMO, even if it did not involve backwards compatibility constraints.
[ Parent
| on HN ]
Re:JEP 430: String Templates (Preview) Proposed to Target Ja...
by Someone on Friday March 03, 2023 @06:41PM
(#35016506)
For another n=1 opinion, I like Swift’s choice, even though it’s different from convention. It’s lighter, typographically. ‘${‘ draws more attention to the delimiters than ‘\(‘.
And yes, the delimiters could be made less obtrusive using syntax coloring, but not all tools will do that (e.g. when using grep on a code base)
Re:JEP 430: String Templates (Preview) Proposed to Target Ja...
by comex on Friday March 03, 2023 @09:29PM
(#35017535)
Swift’s choice has the advantage of visually unifying the two cases where text in a string literal is interpreted as something other than the text itself. One is backslash escapes like \n and \\. The other is string interpolation.