Replies: 4 comments 3 replies
-
|
I'm not sure I would like this personally; we would have to escape every I could see adding this as a compiler flag, though. I guess it's similar to Bourne shell interpolation. |
Beta Was this translation helpful? Give feedback.
-
|
It's a neat idea and potentially worth exploring but the primary challenge is that it would create an incompatibility with existing JS code. We do have some leeway with triple backtick and triple |
Beta Was this translation helpful? Give feedback.
-
|
I'll note that this isn't just a shell thing; Kotlin and PHP do it too, for example. Also, I escape As for other suggestions: maybe require a prefix, like |
Beta Was this translation helpful? Give feedback.
-
|
I'm in favor of adding this as an option. We may even eventually consider making it the default option in conjunction with adding an esCompat option for migrating from TS/JS code. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently template literals are quite verbose requiring a minimum of 3 characters
${}to interpolate an expression which I think is really unnecessary. For a single variable it could be reduced to#variableor$variableinside the template string, and for more complex expressions it can just be put directly between braces, like Rust for example:{expression}.This would mean one has to escape regular braces but I think this is satisfactory because there are 3 ways to create strings.
This could be extended to allow
#variable.keyor$var.key, making object properties easier to interpolate without an extra layer of braces.Beta Was this translation helpful? Give feedback.
All reactions