Skip to content
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

Please support ES6 back-tick for strings #45

Open
intervalia opened this issue Apr 22, 2015 · 2 comments
Open

Please support ES6 back-tick for strings #45

intervalia opened this issue Apr 22, 2015 · 2 comments

Comments

@intervalia
Copy link

ES6 has some wonderful functionality based on strings wrapped in the back-tick (`) instead of the standard double-quote (") and single-quote (') characters.

Please, PLEASE add full support for the ES6 back-tick functionality!

@sparkprime
Copy link
Contributor

This is probably not that hard to implement as a syntax sugar. But the benefit of string interpolation is somewhat watered down by the existing support for Python string formatting:

local total = 37; 
The total is %g (%02g with tax)" % [total, total*1.05]

and the named version:

local o = {total: 37, withTax: 1.05*self.total};
"The total is %(total)g (%(withTax)02g with tax)" % o

which both yield:

"The total is 37 (38.85 with tax)"

With your proposal, you would also be able to do the somewhat similar-looking:

local total = 37;
`The total is ${total} (${"%02g" % (total*1.05)} with tax)`

Which would be desugared to

local total = 37;
("The total is " + total + " (" + "%02g" % (total*1.05) + " with tax)")

With that in mind, how badly do you still want it? :)

@intervalia
Copy link
Author

The main reason I would like to see the back-tick is because I sometimes I move code from a JS file into a JSON file and I hate that I need to undo the ES6 coolness.

It would just be nice to have but not needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants