-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Use of ES6 tagged template literals is currently broken in Coffeescript, unless I'm missing a trick.
Since tagged template literals are not directly supported in Coffeescript, the obvious way of using them is to embed the Javascript directly, like:
`
var a = 5;
var b = 10;
function tag(strings, ...values) {
return "Bazinga!";
};
tag`Hello ${ a + b } world ${ a * b }`;
`However, testing this code on http://js2.coffee, I'm seeing 'unexpected identifier' error on the final "tag" line.
I'm assuming the root cause is that backticks are already used by Coffeescript to mark the start and end of the embedded Javascript section. As such, backticks can't also be used inside the embedded Javascript to make the tagged template literal call.
FYI, I ran into this problem when exploring the newish bel DOM templating library. Since it uses tagged template strings, I believe it's inoperable with current Coffeescript. This is the first time I've seen incompatibility between Coffeescript and Javascript..