ECMAScript 6 template string syntax problem

Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

ECMAScript 6 template string syntax problem

Daniel Dekany
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
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel