-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expression expansion within a string #284
Comments
Looks good to me except for the symbols. Because I'd like to use it in single-line string literals, the quote symbols must not be double quotes or single quotes. Back quote (`) is a candidate; triple backquotes are used for code sections in markdown, though. In addition, we have reasons to avoid # for interpolation: # is used for comments in some programming languages and also used for level-1 header in markdown, which might be confusing, so we'd better to use another symbol, e.g. $. |
So you mean you like to write like this?
I don't prefer $. It's too perlish. |
No, I mean:
And |
Re quote, +1 to using '`'. Re substitution marker, IMO we should choose a character that is (or will become) familiar to ECMAScript programmers. So if the Quasi-literal of ES5 is going to use '$' then we should use it, or if not, we should use '#' (since that is the character used by CoffeeScript and TypeScript?). |
TypeScript does not have string interpolation; there is a discussion found in ITS, though: https://typescript.codeplex.com/workitem/19 ES6 is also considering to use $ http://wiki.ecmascript.org/doku.php?id=harmony:quasis ; I don't know it very well. Dart also uses $ for interpolation: https://www.dartlang.org/docs/dart-up-and-running/contents/ch02.html#strings I gues this is because # is used for location hash and CSS selectors so not suitable for HTML applications. |
If the majority are heading towards using '$' then we should jump on the bandwagon as well. |
The syntax may subject to change.
The text was updated successfully, but these errors were encountered: