I came across with several posts (mentioned in the latest proposal) and found that triple backticks `````` syntax is not backwards compatible.
Here is my testing:
function append(separator) {
return typeof separator === "string" ? appender(separator, "") : appender("", "").apply(this, arguments);
}
function appender(separator, s) {
return function tag(literalParts, ...computedParts) {
s += literalParts[0];
for (let i = 1; i < literalParts.length; ++i) {
s += computedParts[i - 1] + literalParts[i];
}
return function(x) { return x == null ? s : appender(separator, s + separator).apply(this, arguments); };
}
}
var combined = append
`aaa`
`bbb`
`ccc`();
console.log("combined", combined);
var lines = append("\n")
`first line`
`second line`
`third line`();
console.log("lines", lines);
console.log("chaining function result 1", append(", ")`acb``bcd`()) // chaining function result 1 acb, bcd
console.log("chaining function result 2", append(", ")``````()) // chaining function result 2 , ,
Therefore, I am changing my proposed syntax to opening by
@``
and closing by
``
I have no permission to edit my original post above, so I will have to post my updated proposal below.