ECMAScript 6 template string syntax problem

Daniel Dekany <[email protected]> Wed, 17 May 2017 21:59:18 +0200
Newsgroups gmane.comp.web.freemarker.devel
Message-ID <[email protected]>
A recent StackOverflow question made me realize that in ES6 (modern
JavaScript) you can write template strings like this:

  console.log(`Hello ${name}!`)

This syntax clashes with the FTL interpolation syntax. So to prevent
FreeMarker interpreting the ES6 interpolations as FTL interpolations,
currently you have to do something like his:

  console.log(`Hello $<#-- -->{name}!`)

If(!) people will use ES6 template string often, this is of course not
an acceptable solution. Anyway, clashing with the `${...}` syntax is a
quite frequent problem in other scenarios as well. So I guess we
should introduce yet another syntax option to use something else...
not sure what. Maybe @{exp} (and on the same time disable the
deprecated #{...}, which clashes with JSP for example). Or <=exp> and
[=exp] for square bracket tag syntax. Surely it will cause some
confusion when ${exp} is suddenly static text despite what all
examples and the Manual shows (and the Eclipse plugin has to be made
smarter again, etc.), but what else can you do?

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot