Skip to content

Support template literals #466

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

Closed
vgrichina opened this issue Feb 6, 2019 · 8 comments
Closed

Support template literals #466

vgrichina opened this issue Feb 6, 2019 · 8 comments

Comments

@vgrichina
Copy link

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

Regular template literals would be very nice for stuff like logging, so that you can basically have stuff like:

log(`transaction: ${hash} status: ${status}`);

instead of current

log('transaction: ' + hash.toString() + ' status: ' + status.toString());

This looks like a feature which only requires compiler-level sugar and zero runtime support.

More than that, we probably can hijack tagged templated literals to support UTF-8 string literals, i.e. have stuff like:

let utf8String = u`Hello, World`;
@mdaj06
Copy link

mdaj06 commented Mar 5, 2021

@dcodeIO can i have a look at it?

@vgrichina
Copy link
Author

@mdaj06 BTW this issue is something we are interested to give grant for:
https://gov.near.org/t/assemblyscript-grant-q1-2021/697/3

@mdaj06
Copy link

mdaj06 commented Mar 16, 2021

sure got it!

@MaxGraey
Copy link
Member

Template literals mostly finished: #1715

@dcodeIO
Copy link
Member

dcodeIO commented Mar 26, 2021

Initial support for template literals has been merged now, with tagged template literals not enabled just yet due to having to account for an edge case first, which requires implementing ReadonlyArray.

@PaulRBerg
Copy link

Why is this issue still open if #1715 was merged?

It looks like support for template literal was added in v0.18.17

@mattjohnsonpint
Copy link
Contributor

Agreed. This issue should be closed as completed. I use template literals all the time. However, there is one issue I keep encountering, which I just wrote up in #2918.

@CountBleck
Copy link
Member

I'll close this issue now. If there are any bugs in or enhancements for template literals, please make a new issue.

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

7 participants