4 ms·
> escaped opening parens as identifiers for string templates Do you mean the use of “\(variable)” for string interpolation? What’s wrong with that?
by pansa2 6y ago
> escaped opening parens as identifiers for string templates
Do you mean the use of “\(variable)” for string interpolation? What’s wrong with that?
- cutler 6y agoIt's just downright clunky. What's wrong with ${variable} as in Kotlin and Javascript?
- mantap 6y agoThey had good reasons, it means there's only two substrings that need escaping: the backslash and end string sequence. In hindsight, it's ugly and hard to read. A case of optimising for the wrong thing.
- Someone 6y agoI think that’s more a question of taste/what one is used to. I find that dollar sign a bit heavy, visually, but one could also argue that’s a plus. Using backslash has the advantage that there’s only one ‘special’ character in strings, but of course, also has the problem can escape any character with a backsplash, except for opening parentheses.