You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@freemarker.apache.org by Woonsan Ko <wo...@apache.org> on 2017/12/03 21:06:48 UTC

Re: Alternative to ${exp}

On Tue, Nov 28, 2017 at 4:45 AM, Daniel Dekany <dd...@apache.org> wrote:
> This problem comes up again and again: the ${exp} syntax clashes with
> the syntax of the thing the user wants to generate. So I believe we
> need a Configuration option to address this. Something like
> cfg.setInterpolationSyntax(FOO_INTERPOLATION_SYNTAX), and also
> <#ftl interpolationSyntax="foo">.
>
> Like any syntax option, this is potentially confusing for users and
> problem for tools, but I don't think there's a way around this. Users
> have to deal with those clashing ${}-s somehow, and certainly an
> in-house hack will be worse and even more confusing. (Surely they can
> write ${'$'}{foo} or use #noparse, but if you need a lot of those,
> then it's obviously not an acceptable workaround.)
>
> So, what the syntax would be? Some of my ideas:
>
> - {{exp}} is probably the nicest. For the same reason it potentially
>   clashes with something yet again, though I guess it's unlikely
>   enough that neither ${exp} nor {{exp}} works for you.
>
> - @{exp}. It's similar to ${exp}, which I think is an advantage.
>   There's however a very small but still real chance that for someone
>   both ${} and @{} clashes with what they want to generate, because
>   using <someChar>{name} is somewhat popular.
>
> - #{exp}. That looks like the natural choice as we use # in tags as
>   well (also @, though). The reason I don't like it is that
>   we already have #{exp} in the standard syntax, but it's deprecated.
>   That's not a problem technically, as you can say that if you select
>   the #{} syntax, then it's not deprecated, and ${} will be treated
>   as static text. But now if someone sees #{exp}, they can't tell if
>   the template uses a deprecated syntax, or it uses the alternative
>   interpolation syntax. Also it's perhaps more likely that for someone
>   both ${} and #{} clashes (e.g. in the case you generate JSF JSP-s),
>   than that that both ${} and @{} clashes.
>
> - <=exp> and [=exp] depending on if you are using square- or
>   angle-bracket tag syntax. Look somewhat exotic... which also means
>   that hopefully it won't clash with anything.

I personally prefer the style with square-bracket: [=exp], which seems
most unique and intuitive.
It is also most productive as no shift key is required.
I like [=exp] better than <=exp> by the way, because the latter is
confusing (looks like <%=exp>) and requiring shift keys.

Regards,

Woonsan

>
> There's also the idea that we just let the user specify any separator,
> like `cfg.setInterpolationStart("@{"); cfg.setInterpolationEnd("}")`.
> But if all kind of random syntax is possible, it's harder for users to
> figure out what's going on (their syntax isn't mentioned in the
> Manual, and nobody on StackOverlfow recognizes it either), and it's
> more difficult to support that in tools as well. So I believe it's
> better for everyone if there's one, or maybe two standard
> alternatives. (Not to mention that I don't yet see how to implement
> such a runtime-configured syntax with the current JavaCC-based parser.
> Probably it would be a horrid hack if possible at all.)
>
> Opinions, ideas?
>
> --
> Thanks,
>  Daniel Dekany
>

Re: Alternative to ${exp}

Posted by Daniel Dekany <dd...@apache.org>.
Sunday, December 3, 2017, 10:06:48 PM, Woonsan Ko wrote:

> On Tue, Nov 28, 2017 at 4:45 AM, Daniel Dekany <dd...@apache.org> wrote:
>> This problem comes up again and again: the ${exp} syntax clashes with
>> the syntax of the thing the user wants to generate. So I believe we
>> need a Configuration option to address this. Something like
>> cfg.setInterpolationSyntax(FOO_INTERPOLATION_SYNTAX), and also
>> <#ftl interpolationSyntax="foo">.
>>
>> Like any syntax option, this is potentially confusing for users and
>> problem for tools, but I don't think there's a way around this. Users
>> have to deal with those clashing ${}-s somehow, and certainly an
>> in-house hack will be worse and even more confusing. (Surely they can
>> write ${'$'}{foo} or use #noparse, but if you need a lot of those,
>> then it's obviously not an acceptable workaround.)
>>
>> So, what the syntax would be? Some of my ideas:
>>
>> - {{exp}} is probably the nicest. For the same reason it potentially
>>   clashes with something yet again, though I guess it's unlikely
>>   enough that neither ${exp} nor {{exp}} works for you.
>>
>> - @{exp}. It's similar to ${exp}, which I think is an advantage.
>>   There's however a very small but still real chance that for someone
>>   both ${} and @{} clashes with what they want to generate, because
>>   using <someChar>{name} is somewhat popular.
>>
>> - #{exp}. That looks like the natural choice as we use # in tags as
>>   well (also @, though). The reason I don't like it is that
>>   we already have #{exp} in the standard syntax, but it's deprecated.
>>   That's not a problem technically, as you can say that if you select
>>   the #{} syntax, then it's not deprecated, and ${} will be treated
>>   as static text. But now if someone sees #{exp}, they can't tell if
>>   the template uses a deprecated syntax, or it uses the alternative
>>   interpolation syntax. Also it's perhaps more likely that for someone
>>   both ${} and #{} clashes (e.g. in the case you generate JSF JSP-s),
>>   than that that both ${} and @{} clashes.
>>
>> - <=exp> and [=exp] depending on if you are using square- or
>>   angle-bracket tag syntax. Look somewhat exotic... which also means
>>   that hopefully it won't clash with anything.
>
> I personally prefer the style with square-bracket: [=exp], which seems
> most unique and intuitive.

You mean, even if you're using the angle bracket tag syntax (like
<#if foo>)? If somebody cares about pressing shift, I think he can use
square bracket tag syntax (like [#if something]), and so spare the
shifts needed for the tags as well. I have assumed that otherwise it
worths more that <=exp> is more consistent with the tag syntax. But
maybe it doesn't after all.

Actually, [=exp] has the slight advantage that it doesn't interfere
with the HTML/XML syntax (which FreeMarker doesn't care about, but
some tools can get confused), similarly as ${exp} didn't. As some
users mostly only use interpolations inside HTML/XML tags, I can
immagine that they aren't concerned enough about the angle brackes of
the FTL tags to switch to the less well known square bracket syntax.

Also, if the interpolation syntax doesn't depend on the tag synax
(it's always [#exp]), that might prevents some user confusion. Also it
doesn't complicate the parser that much.

> It is also most productive as no shift key is required.
> I like [=exp] better than <=exp> by the way, because the latter is
> confusing (looks like <%=exp>) and requiring shift keys.

So far we have heard 3 preferences:
- {{exp}}
- <someChar>{exp}, where <someChar> is specified in the Configuration,
  so you end up with something like @{exp}, %{exp}, etc.
- [=exp], but even if the tagSyntax setting is angle-brackets (if I
  understand well).

I'm torn between all three, with a slight bias towards [=exp] now.
That's probably the most practical solution, except, some users can't
stand unusually looking syntax like that.

> Regards,
>
> Woonsan
>
>>
>> There's also the idea that we just let the user specify any separator,
>> like `cfg.setInterpolationStart("@{"); cfg.setInterpolationEnd("}")`.
>> But if all kind of random syntax is possible, it's harder for users to
>> figure out what's going on (their syntax isn't mentioned in the
>> Manual, and nobody on StackOverlfow recognizes it either), and it's
>> more difficult to support that in tools as well. So I believe it's
>> better for everyone if there's one, or maybe two standard
>> alternatives. (Not to mention that I don't yet see how to implement
>> such a runtime-configured syntax with the current JavaCC-based parser.
>> Probably it would be a horrid hack if possible at all.)
>>
>> Opinions, ideas?
>>
>> --
>> Thanks,
>>  Daniel Dekany
>>
>

-- 
Thanks,
 Daniel Dekany


Re: Alternative to ${exp}

Posted by Jacques Le Roux <ja...@les7arts.com>.
Le 04/12/2017 à 10:20, Daniel Dekany a écrit :
> Monday, December 4, 2017, 6:50:20 AM, Jacques Le Roux wrote:
>
>> Le 03/12/2017 à 22:06, Woonsan Ko a écrit :
>>> It is also most productive as no shift key is required.
>> Depends on keyboard, for French keyboard type (azerty) you need to use Alt key ;)
>> Same for {{...}} anyway
> Good point. Same on Hungarian keyboard (though I had to check... I
> never type source code with hunarian layout). But programming
> languages was created with US keyboard in mind, so surely the
> developers who are still working using their national keyboard layout
> doesn't care much about pressing "Alt Gr". (On Hungarian keyboard even
> ";" needs "Alt Gr", yet most colegues use Hungarian layout for Java.)
> And those who do care will be happier with an English layout friendly
> syntax. Though, templates are somewhat different from usual source
> code in that they tend to contain more national text, or are edited by
> non-programmers, so US layout friendlines has a bit less gain there.
Just for fun, I began to work mostly in APL https://en.wikipedia.org/wiki/APL_(programming_language) and earned my life during 20 years with it.
After few years I was so used about it that I could work without the APL keyboard layout printed. Actually with APL2 came around few more symbols.
Then I never cared much about key combinations, azerty or not ;)

Jacques

Re: Alternative to ${exp}

Posted by Daniel Dekany <dd...@apache.org>.
Monday, December 4, 2017, 6:50:20 AM, Jacques Le Roux wrote:

> Le 03/12/2017 à 22:06, Woonsan Ko a écrit :
>> It is also most productive as no shift key is required.
> Depends on keyboard, for French keyboard type (azerty) you need to use Alt key ;)
> Same for {{...}} anyway

Good point. Same on Hungarian keyboard (though I had to check... I
never type source code with hunarian layout). But programming
languages was created with US keyboard in mind, so surely the
developers who are still working using their national keyboard layout
doesn't care much about pressing "Alt Gr". (On Hungarian keyboard even
";" needs "Alt Gr", yet most colegues use Hungarian layout for Java.)
And those who do care will be happier with an English layout friendly
syntax. Though, templates are somewhat different from usual source
code in that they tend to contain more national text, or are edited by
non-programmers, so US layout friendlines has a bit less gain there.

> Jacques
>
>

-- 
Thanks,
 Daniel Dekany


Re: Alternative to ${exp}

Posted by Taher Alkhateeb <sl...@gmail.com>.
Sounds good.

On Dec 15, 2017 1:28 PM, "Daniel Dekany" <dd...@apache.org> wrote:

> OK, so I would go for [=exp] (see the reason told in this thread). How
> acceptable is that guys?
>
>
> Tuesday, December 5, 2017, 11:56:59 AM, Woonsan Ko wrote:
>
> > On Mon, Dec 4, 2017 at 10:28 AM, Daniel Dekany <dd...@apache.org>
> wrote:
> >> Monday, December 4, 2017, 10:21:48 AM, Taher Alkhateeb wrote:
> >>
> >>> uh-huh, but I suspect maybe more collisions or need to escape
> >>> character in something like [this] or <this> than {{this}}. Anyway,
> >>> nothing critical IMO, only thinking out loud.
> >>
> >> But they were [=this] and <=this>, so the sequences that will clash
> >> are "[=" and "<=", which are quite rare. Oh wait... "<=" is not rare
> >> at all: "if (x <= y)". But "[=" still is. OK, so I guess at this point
> >> the two competitors left are {{exp}} and [=exp] (regardless of tag
> >> syntax).
> >
> > +1.00 on [=exp].
> > +0.49 on {{exp}}.
> >
> > :-D
> >
> > Many languages or templates allows ${exp}, including JavaScript. [1]
> > And, mustache is supported in many languages or templates, too. [2]
> > Therefore, I think there are more chances using both ${exp} and
> > {{exp}} in output we want to generate in the future.
> > The mustache style looks charming at the moment, but I wonder how its
> > charming can help for the original intention (to avoid any possible
> > collision in the output we want to generate by an alternative as much
> > as we can).
> >
> > Regards,
> >
> > Woonsan
> >
> > [1] https://en.wikipedia.org/wiki/String_interpolation
> > [2] https://mustache.github.io/
> >
> >>
> >>> On Mon, Dec 4, 2017 at 12:00 PM, Daniel Dekany <dd...@apache.org>
> wrote:
> >>>> Monday, December 4, 2017, 9:17:34 AM, Taher Alkhateeb wrote:
> >>>>
> >>>>> So maybe a safe bet (and a familiar one) is the mustache syntax.
> >>>>>
> >>>>> In addition to avoiding clashes it might help with a multi-chained
> >>>>> template. For example, we use FreeMarker extensively in Apache OFBiz
> >>>>> to generate many documents including XML. Now our XML documents might
> >>>>> contain some ${variable} that needs to be interpreted in the XML
> >>>>> parser, not the freemarker parser (without having to escape
> characters
> >>>>> everywhere)
> >>>>
> >>>> Though that also works with all the other proposal syntaxes as well.
> >>>>
> >>>>> On Mon, Dec 4, 2017 at 8:50 AM, Jacques Le Roux
> >>>>> <ja...@les7arts.com> wrote:
> >>>>>> Le 03/12/2017 à 22:06, Woonsan Ko a écrit :
> >>>>>>>
> >>>>>>> It is also most productive as no shift key is required.
> >>>>>>
> >>>>>> Depends on keyboard, for French keyboard type (azerty) you need to
> use Alt
> >>>>>> key ;)
> >>>>>> Same for {{...}} anyway
> >>>>>>
> >>>>>> Jacques
> >>>>>>
> >>>>>
> >>>>
> >>>> --
> >>>> Thanks,
> >>>>  Daniel Dekany
> >>>>
> >>>
> >>
> >> --
> >> Thanks,
> >>  Daniel Dekany
> >>
> >
>
> --
> Thanks,
>  Daniel Dekany
>
>

Re: Alternative to ${exp}

Posted by Daniel Dekany <dd...@apache.org>.
Sunday, March 25, 2018, 4:45:05 PM, Woonsan Ko wrote:

> On Sat, Mar 24, 2018 at 1:30 PM, Daniel Dekany <dd...@apache.org> wrote:
>> Saturday, March 24, 2018, 4:33:01 PM, Woonsan Ko wrote:
>>
>>> Hi folks,
>>>
>>> I'd like to bring this topic again to our attention.
>>> It started totally my own mistake by being confused "Square bracket
>>> tag syntax" (since 2.3.4) with the new "Square bracket interpolation
>>> syntax" (since 2.3.28). [1]
>>> Here's my example in another thread [2]:
>>>
>>> 1: [#ftl output_format="HTML"]
>>> 2: [#assign a=[1,2,3]]
>>> 3: [="Hello"]
>>>
>>> #1 and #2 work as they are using the "Square bracket tag syntax", but
>>> #3 doesn't by default (unless you change the configuration to use
>>> "Square bracket interpolation" option).
>>> So, it should have been like the following for intention:
>>>
>>> 1: [#ftl output_format="HTML"]
>>> 2: [#assign a=[1,2,3]]
>>> 3: ${"Hello"}
>>>
>>> Now, I'm wondering if this kind of confusion could happen more to other people.
>>> When they use square bracket tag syntax, they might be easily doing
>>> the same thing for the interpolation like the first example.
>>>
>>> One possible solution could be to use mustache as the default
>>> alternative for interpolation like this:
>>>
>>> 1: [#ftl output_format="HTML"]
>>> 2: [#assign a=[1,2,3]]
>>> 3: {{"Hello"}}
>>>
>>> As interpolation's alternative syntax is to use mustache, it might be
>>> less confusing by not using the same syntax for both tags and
>>> interpolation.
>>> My old reason why avoiding mustache was, Javascript framework could
>>> use both '${something}' [3] and '{{something}}' together. But also if
>>> someones adopts mustache style JS frameworks, they might not use the
>>> technique like [3]. Not sure though...
>>
>> After re-reading and re-thinking the thread, I'm back to the opinion
>> that fighting the confusion arousing from the mere coincidence that
>> both things are "square bracket" is the better compromise:
>>
>> - While using {{...}} in output is not very frequent, when it's used
>>   in the output, there's a quite real chance that the output also uses
>>   ${...}. A lot of languages and formats use ${...}, now including the
>>   omnipresent JavaScript, and so ${...} will become more frequent in
>>   web pages in the future. So, if you generate Angular pages for
>>   example, it's quite possible that they use both... and then what
>>   will you do?
> Good point!
>
>>
>> - Using square bracket tag syntax together with square bracket
>>   interpolation syntax makes template-templates (a template of a
>>   template, be it FreeMarker template, JSP, etc.) easy to read, as
>>   your visual cortex can just hunt for the [...]-s. It matters because
>>   template-templates tend to be already messy, I guess.
>>
>> BTW, I have discovered a slight drawback of [=...] while using it.
>> Instead of ${x} you write [=x], fine. But what do you write instead of
>> ${x + 1}? The logical one is [=x + 1], but its spacing is ugly, so I
>> think it's going to be [= x + 1]. One more space. Yeah, quite a nick
>> picking, but just so you know about it...
> Or [=(x + 1)] just for clarity?

That strikes me as more noisy than the original.

>>> Another possible option could be to allow to change the interpolation
>>> syntax to square bracket automatically as well if the first [#ftl ...]
>>> is used like the tag syntax's automatic switching per template.
>>> But I'm not sure what the implication is behind about this.
>>
>> Templates that did work earlier won't, which is a pretty concrete
>> implication. (: I wish we only had <#>+${} and [#]+[=] from the
>> beginning, but now we can't do that. Not in FM2 at least. Maybe we
>> should do that in FM3. Actually, yeah, it would be much easier if one
>> can just chose a "template syntax", not a "tag syntax" and an
>> "interpolation syntax".
> Right. We cannot do that in FM2.
> I prefer having fewer/simpler options in FM3, so it sounds great to
> have only "template syntax" for both in FM3.

I will talk about this in another thread.

>>> What do you think? Would my confusion be ignorable or do we need to
>>> think about the alternative interpolation syntax again?
>>
>> It's not ignorable, but there are multiple ways of countering this. My
>> grand plan (: is that some people will do that oversight you did, but
>> they will realize pretty quickly that something is wrong (it's not the
>> kind of problem that can remain hidden), and then they will ask
>> Google, and hopefully will not be able to avoid the "notices" I stick
>> every place where we are talking about square brackets. How about
>> that?
> That sounds like a grand plan! Let's keep the square bracket
> interpolation syntax as-is and stick into everywhere! Sounds like a
> non-harmful, potentially viral "square" in the squares! ;-)
>
> Cheers,
>
> Woonsan
>
>>
>>> Kind regards,
>>>
>>> Woonsan
>>>
>>> [1]
>>> https://freemarker.apache.org/builds/fm2.3.28/dgui_misc_alternativesyntax.html
>>> [2]
>>> https://lists.apache.org/thread.html/2372e673c5b8bd91150f7dd43319786dda8af38acdef87cd37f09ead@%3Cdev.freemarker.apache.org%3E
>>> [3] https://en.wikipedia.org/wiki/String_interpolation#JavaScript
>>>
>>> On Fri, Dec 15, 2017 at 5:28 AM, Daniel Dekany <dd...@apache.org> wrote:
>>>> OK, so I would go for [=exp] (see the reason told in this thread). How
>>>> acceptable is that guys?
>>>>
>>>>
>>>> Tuesday, December 5, 2017, 11:56:59 AM, Woonsan Ko wrote:
>>>>
>>>>> On Mon, Dec 4, 2017 at 10:28 AM, Daniel Dekany <dd...@apache.org> wrote:
>>>>>> Monday, December 4, 2017, 10:21:48 AM, Taher Alkhateeb wrote:
>>>>>>
>>>>>>> uh-huh, but I suspect maybe more collisions or need to escape
>>>>>>> character in something like [this] or <this> than {{this}}. Anyway,
>>>>>>> nothing critical IMO, only thinking out loud.
>>>>>>
>>>>>> But they were [=this] and <=this>, so the sequences that will clash
>>>>>> are "[=" and "<=", which are quite rare. Oh wait... "<=" is not rare
>>>>>> at all: "if (x <= y)". But "[=" still is. OK, so I guess at this point
>>>>>> the two competitors left are {{exp}} and [=exp] (regardless of tag
>>>>>> syntax).
>>>>>
>>>>> +1.00 on [=exp].
>>>>> +0.49 on {{exp}}.
>>>>>
>>>>> :-D
>>>>>
>>>>> Many languages or templates allows ${exp}, including JavaScript. [1]
>>>>> And, mustache is supported in many languages or templates, too. [2]
>>>>> Therefore, I think there are more chances using both ${exp} and
>>>>> {{exp}} in output we want to generate in the future.
>>>>> The mustache style looks charming at the moment, but I wonder how its
>>>>> charming can help for the original intention (to avoid any possible
>>>>> collision in the output we want to generate by an alternative as much
>>>>> as we can).
>>>>>
>>>>> Regards,
>>>>>
>>>>> Woonsan
>>>>>
>>>>> [1] https://en.wikipedia.org/wiki/String_interpolation
>>>>> [2] https://mustache.github.io/
>>>>>
>>>>>>
>>>>>>> On Mon, Dec 4, 2017 at 12:00 PM, Daniel Dekany <dd...@apache.org> wrote:
>>>>>>>> Monday, December 4, 2017, 9:17:34 AM, Taher Alkhateeb wrote:
>>>>>>>>
>>>>>>>>> So maybe a safe bet (and a familiar one) is the mustache syntax.
>>>>>>>>>
>>>>>>>>> In addition to avoiding clashes it might help with a multi-chained
>>>>>>>>> template. For example, we use FreeMarker extensively in Apache OFBiz
>>>>>>>>> to generate many documents including XML. Now our XML documents might
>>>>>>>>> contain some ${variable} that needs to be interpreted in the XML
>>>>>>>>> parser, not the freemarker parser (without having to escape characters
>>>>>>>>> everywhere)
>>>>>>>>
>>>>>>>> Though that also works with all the other proposal syntaxes as well.
>>>>>>>>
>>>>>>>>> On Mon, Dec 4, 2017 at 8:50 AM, Jacques Le Roux
>>>>>>>>> <ja...@les7arts.com> wrote:
>>>>>>>>>> Le 03/12/2017 à 22:06, Woonsan Ko a écrit :
>>>>>>>>>>>
>>>>>>>>>>> It is also most productive as no shift key is required.
>>>>>>>>>>
>>>>>>>>>> Depends on keyboard, for French keyboard type (azerty) you need to use Alt
>>>>>>>>>> key ;)
>>>>>>>>>> Same for {{...}} anyway
>>>>>>>>>>
>>>>>>>>>> Jacques
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Thanks,
>>>>>>>>  Daniel Dekany
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> Thanks,
>>>>>>  Daniel Dekany
>>>>>>
>>>>>
>>>>
>>>> --
>>>> Thanks,
>>>>  Daniel Dekany
>>>>
>>>
>>
>> --
>> Thanks,
>>  Daniel Dekany
>>
>

-- 
Thanks,
 Daniel Dekany


Re: Alternative to ${exp}

Posted by Woonsan Ko <wo...@apache.org>.
On Sat, Mar 24, 2018 at 1:30 PM, Daniel Dekany <dd...@apache.org> wrote:
> Saturday, March 24, 2018, 4:33:01 PM, Woonsan Ko wrote:
>
>> Hi folks,
>>
>> I'd like to bring this topic again to our attention.
>> It started totally my own mistake by being confused "Square bracket
>> tag syntax" (since 2.3.4) with the new "Square bracket interpolation
>> syntax" (since 2.3.28). [1]
>> Here's my example in another thread [2]:
>>
>> 1: [#ftl output_format="HTML"]
>> 2: [#assign a=[1,2,3]]
>> 3: [="Hello"]
>>
>> #1 and #2 work as they are using the "Square bracket tag syntax", but
>> #3 doesn't by default (unless you change the configuration to use
>> "Square bracket interpolation" option).
>> So, it should have been like the following for intention:
>>
>> 1: [#ftl output_format="HTML"]
>> 2: [#assign a=[1,2,3]]
>> 3: ${"Hello"}
>>
>> Now, I'm wondering if this kind of confusion could happen more to other people.
>> When they use square bracket tag syntax, they might be easily doing
>> the same thing for the interpolation like the first example.
>>
>> One possible solution could be to use mustache as the default
>> alternative for interpolation like this:
>>
>> 1: [#ftl output_format="HTML"]
>> 2: [#assign a=[1,2,3]]
>> 3: {{"Hello"}}
>>
>> As interpolation's alternative syntax is to use mustache, it might be
>> less confusing by not using the same syntax for both tags and
>> interpolation.
>> My old reason why avoiding mustache was, Javascript framework could
>> use both '${something}' [3] and '{{something}}' together. But also if
>> someones adopts mustache style JS frameworks, they might not use the
>> technique like [3]. Not sure though...
>
> After re-reading and re-thinking the thread, I'm back to the opinion
> that fighting the confusion arousing from the mere coincidence that
> both things are "square bracket" is the better compromise:
>
> - While using {{...}} in output is not very frequent, when it's used
>   in the output, there's a quite real chance that the output also uses
>   ${...}. A lot of languages and formats use ${...}, now including the
>   omnipresent JavaScript, and so ${...} will become more frequent in
>   web pages in the future. So, if you generate Angular pages for
>   example, it's quite possible that they use both... and then what
>   will you do?
Good point!

>
> - Using square bracket tag syntax together with square bracket
>   interpolation syntax makes template-templates (a template of a
>   template, be it FreeMarker template, JSP, etc.) easy to read, as
>   your visual cortex can just hunt for the [...]-s. It matters because
>   template-templates tend to be already messy, I guess.
>
> BTW, I have discovered a slight drawback of [=...] while using it.
> Instead of ${x} you write [=x], fine. But what do you write instead of
> ${x + 1}? The logical one is [=x + 1], but its spacing is ugly, so I
> think it's going to be [= x + 1]. One more space. Yeah, quite a nick
> picking, but just so you know about it...
Or [=(x + 1)] just for clarity?

>
>> Another possible option could be to allow to change the interpolation
>> syntax to square bracket automatically as well if the first [#ftl ...]
>> is used like the tag syntax's automatic switching per template.
>> But I'm not sure what the implication is behind about this.
>
> Templates that did work earlier won't, which is a pretty concrete
> implication. (: I wish we only had <#>+${} and [#]+[=] from the
> beginning, but now we can't do that. Not in FM2 at least. Maybe we
> should do that in FM3. Actually, yeah, it would be much easier if one
> can just chose a "template syntax", not a "tag syntax" and an
> "interpolation syntax".
Right. We cannot do that in FM2.
I prefer having fewer/simpler options in FM3, so it sounds great to
have only "template syntax" for both in FM3.

>
>> What do you think? Would my confusion be ignorable or do we need to
>> think about the alternative interpolation syntax again?
>
> It's not ignorable, but there are multiple ways of countering this. My
> grand plan (: is that some people will do that oversight you did, but
> they will realize pretty quickly that something is wrong (it's not the
> kind of problem that can remain hidden), and then they will ask
> Google, and hopefully will not be able to avoid the "notices" I stick
> every place where we are talking about square brackets. How about
> that?
That sounds like a grand plan! Let's keep the square bracket
interpolation syntax as-is and stick into everywhere! Sounds like a
non-harmful, potentially viral "square" in the squares! ;-)

Cheers,

Woonsan

>
>> Kind regards,
>>
>> Woonsan
>>
>> [1]
>> https://freemarker.apache.org/builds/fm2.3.28/dgui_misc_alternativesyntax.html
>> [2]
>> https://lists.apache.org/thread.html/2372e673c5b8bd91150f7dd43319786dda8af38acdef87cd37f09ead@%3Cdev.freemarker.apache.org%3E
>> [3] https://en.wikipedia.org/wiki/String_interpolation#JavaScript
>>
>> On Fri, Dec 15, 2017 at 5:28 AM, Daniel Dekany <dd...@apache.org> wrote:
>>> OK, so I would go for [=exp] (see the reason told in this thread). How
>>> acceptable is that guys?
>>>
>>>
>>> Tuesday, December 5, 2017, 11:56:59 AM, Woonsan Ko wrote:
>>>
>>>> On Mon, Dec 4, 2017 at 10:28 AM, Daniel Dekany <dd...@apache.org> wrote:
>>>>> Monday, December 4, 2017, 10:21:48 AM, Taher Alkhateeb wrote:
>>>>>
>>>>>> uh-huh, but I suspect maybe more collisions or need to escape
>>>>>> character in something like [this] or <this> than {{this}}. Anyway,
>>>>>> nothing critical IMO, only thinking out loud.
>>>>>
>>>>> But they were [=this] and <=this>, so the sequences that will clash
>>>>> are "[=" and "<=", which are quite rare. Oh wait... "<=" is not rare
>>>>> at all: "if (x <= y)". But "[=" still is. OK, so I guess at this point
>>>>> the two competitors left are {{exp}} and [=exp] (regardless of tag
>>>>> syntax).
>>>>
>>>> +1.00 on [=exp].
>>>> +0.49 on {{exp}}.
>>>>
>>>> :-D
>>>>
>>>> Many languages or templates allows ${exp}, including JavaScript. [1]
>>>> And, mustache is supported in many languages or templates, too. [2]
>>>> Therefore, I think there are more chances using both ${exp} and
>>>> {{exp}} in output we want to generate in the future.
>>>> The mustache style looks charming at the moment, but I wonder how its
>>>> charming can help for the original intention (to avoid any possible
>>>> collision in the output we want to generate by an alternative as much
>>>> as we can).
>>>>
>>>> Regards,
>>>>
>>>> Woonsan
>>>>
>>>> [1] https://en.wikipedia.org/wiki/String_interpolation
>>>> [2] https://mustache.github.io/
>>>>
>>>>>
>>>>>> On Mon, Dec 4, 2017 at 12:00 PM, Daniel Dekany <dd...@apache.org> wrote:
>>>>>>> Monday, December 4, 2017, 9:17:34 AM, Taher Alkhateeb wrote:
>>>>>>>
>>>>>>>> So maybe a safe bet (and a familiar one) is the mustache syntax.
>>>>>>>>
>>>>>>>> In addition to avoiding clashes it might help with a multi-chained
>>>>>>>> template. For example, we use FreeMarker extensively in Apache OFBiz
>>>>>>>> to generate many documents including XML. Now our XML documents might
>>>>>>>> contain some ${variable} that needs to be interpreted in the XML
>>>>>>>> parser, not the freemarker parser (without having to escape characters
>>>>>>>> everywhere)
>>>>>>>
>>>>>>> Though that also works with all the other proposal syntaxes as well.
>>>>>>>
>>>>>>>> On Mon, Dec 4, 2017 at 8:50 AM, Jacques Le Roux
>>>>>>>> <ja...@les7arts.com> wrote:
>>>>>>>>> Le 03/12/2017 à 22:06, Woonsan Ko a écrit :
>>>>>>>>>>
>>>>>>>>>> It is also most productive as no shift key is required.
>>>>>>>>>
>>>>>>>>> Depends on keyboard, for French keyboard type (azerty) you need to use Alt
>>>>>>>>> key ;)
>>>>>>>>> Same for {{...}} anyway
>>>>>>>>>
>>>>>>>>> Jacques
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Thanks,
>>>>>>>  Daniel Dekany
>>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Thanks,
>>>>>  Daniel Dekany
>>>>>
>>>>
>>>
>>> --
>>> Thanks,
>>>  Daniel Dekany
>>>
>>
>
> --
> Thanks,
>  Daniel Dekany
>

Re: Alternative to ${exp}

Posted by Daniel Dekany <dd...@apache.org>.
Saturday, March 24, 2018, 4:33:01 PM, Woonsan Ko wrote:

> Hi folks,
>
> I'd like to bring this topic again to our attention.
> It started totally my own mistake by being confused "Square bracket
> tag syntax" (since 2.3.4) with the new "Square bracket interpolation
> syntax" (since 2.3.28). [1]
> Here's my example in another thread [2]:
>
> 1: [#ftl output_format="HTML"]
> 2: [#assign a=[1,2,3]]
> 3: [="Hello"]
>
> #1 and #2 work as they are using the "Square bracket tag syntax", but
> #3 doesn't by default (unless you change the configuration to use
> "Square bracket interpolation" option).
> So, it should have been like the following for intention:
>
> 1: [#ftl output_format="HTML"]
> 2: [#assign a=[1,2,3]]
> 3: ${"Hello"}
>
> Now, I'm wondering if this kind of confusion could happen more to other people.
> When they use square bracket tag syntax, they might be easily doing
> the same thing for the interpolation like the first example.
>
> One possible solution could be to use mustache as the default
> alternative for interpolation like this:
>
> 1: [#ftl output_format="HTML"]
> 2: [#assign a=[1,2,3]]
> 3: {{"Hello"}}
>
> As interpolation's alternative syntax is to use mustache, it might be
> less confusing by not using the same syntax for both tags and
> interpolation.
> My old reason why avoiding mustache was, Javascript framework could
> use both '${something}' [3] and '{{something}}' together. But also if
> someones adopts mustache style JS frameworks, they might not use the
> technique like [3]. Not sure though...

After re-reading and re-thinking the thread, I'm back to the opinion
that fighting the confusion arousing from the mere coincidence that
both things are "square bracket" is the better compromise:

- While using {{...}} in output is not very frequent, when it's used
  in the output, there's a quite real chance that the output also uses
  ${...}. A lot of languages and formats use ${...}, now including the
  omnipresent JavaScript, and so ${...} will become more frequent in
  web pages in the future. So, if you generate Angular pages for
  example, it's quite possible that they use both... and then what
  will you do?

- Using square bracket tag syntax together with square bracket
  interpolation syntax makes template-templates (a template of a
  template, be it FreeMarker template, JSP, etc.) easy to read, as
  your visual cortex can just hunt for the [...]-s. It matters because
  template-templates tend to be already messy, I guess.

BTW, I have discovered a slight drawback of [=...] while using it.
Instead of ${x} you write [=x], fine. But what do you write instead of
${x + 1}? The logical one is [=x + 1], but its spacing is ugly, so I
think it's going to be [= x + 1]. One more space. Yeah, quite a nick
picking, but just so you know about it...

> Another possible option could be to allow to change the interpolation
> syntax to square bracket automatically as well if the first [#ftl ...]
> is used like the tag syntax's automatic switching per template.
> But I'm not sure what the implication is behind about this.

Templates that did work earlier won't, which is a pretty concrete
implication. (: I wish we only had <#>+${} and [#]+[=] from the
beginning, but now we can't do that. Not in FM2 at least. Maybe we
should do that in FM3. Actually, yeah, it would be much easier if one
can just chose a "template syntax", not a "tag syntax" and an
"interpolation syntax".

> What do you think? Would my confusion be ignorable or do we need to
> think about the alternative interpolation syntax again?

It's not ignorable, but there are multiple ways of countering this. My
grand plan (: is that some people will do that oversight you did, but
they will realize pretty quickly that something is wrong (it's not the
kind of problem that can remain hidden), and then they will ask
Google, and hopefully will not be able to avoid the "notices" I stick
every place where we are talking about square brackets. How about
that?

> Kind regards,
>
> Woonsan
>
> [1]
> https://freemarker.apache.org/builds/fm2.3.28/dgui_misc_alternativesyntax.html
> [2]
> https://lists.apache.org/thread.html/2372e673c5b8bd91150f7dd43319786dda8af38acdef87cd37f09ead@%3Cdev.freemarker.apache.org%3E
> [3] https://en.wikipedia.org/wiki/String_interpolation#JavaScript
>
> On Fri, Dec 15, 2017 at 5:28 AM, Daniel Dekany <dd...@apache.org> wrote:
>> OK, so I would go for [=exp] (see the reason told in this thread). How
>> acceptable is that guys?
>>
>>
>> Tuesday, December 5, 2017, 11:56:59 AM, Woonsan Ko wrote:
>>
>>> On Mon, Dec 4, 2017 at 10:28 AM, Daniel Dekany <dd...@apache.org> wrote:
>>>> Monday, December 4, 2017, 10:21:48 AM, Taher Alkhateeb wrote:
>>>>
>>>>> uh-huh, but I suspect maybe more collisions or need to escape
>>>>> character in something like [this] or <this> than {{this}}. Anyway,
>>>>> nothing critical IMO, only thinking out loud.
>>>>
>>>> But they were [=this] and <=this>, so the sequences that will clash
>>>> are "[=" and "<=", which are quite rare. Oh wait... "<=" is not rare
>>>> at all: "if (x <= y)". But "[=" still is. OK, so I guess at this point
>>>> the two competitors left are {{exp}} and [=exp] (regardless of tag
>>>> syntax).
>>>
>>> +1.00 on [=exp].
>>> +0.49 on {{exp}}.
>>>
>>> :-D
>>>
>>> Many languages or templates allows ${exp}, including JavaScript. [1]
>>> And, mustache is supported in many languages or templates, too. [2]
>>> Therefore, I think there are more chances using both ${exp} and
>>> {{exp}} in output we want to generate in the future.
>>> The mustache style looks charming at the moment, but I wonder how its
>>> charming can help for the original intention (to avoid any possible
>>> collision in the output we want to generate by an alternative as much
>>> as we can).
>>>
>>> Regards,
>>>
>>> Woonsan
>>>
>>> [1] https://en.wikipedia.org/wiki/String_interpolation
>>> [2] https://mustache.github.io/
>>>
>>>>
>>>>> On Mon, Dec 4, 2017 at 12:00 PM, Daniel Dekany <dd...@apache.org> wrote:
>>>>>> Monday, December 4, 2017, 9:17:34 AM, Taher Alkhateeb wrote:
>>>>>>
>>>>>>> So maybe a safe bet (and a familiar one) is the mustache syntax.
>>>>>>>
>>>>>>> In addition to avoiding clashes it might help with a multi-chained
>>>>>>> template. For example, we use FreeMarker extensively in Apache OFBiz
>>>>>>> to generate many documents including XML. Now our XML documents might
>>>>>>> contain some ${variable} that needs to be interpreted in the XML
>>>>>>> parser, not the freemarker parser (without having to escape characters
>>>>>>> everywhere)
>>>>>>
>>>>>> Though that also works with all the other proposal syntaxes as well.
>>>>>>
>>>>>>> On Mon, Dec 4, 2017 at 8:50 AM, Jacques Le Roux
>>>>>>> <ja...@les7arts.com> wrote:
>>>>>>>> Le 03/12/2017 à 22:06, Woonsan Ko a écrit :
>>>>>>>>>
>>>>>>>>> It is also most productive as no shift key is required.
>>>>>>>>
>>>>>>>> Depends on keyboard, for French keyboard type (azerty) you need to use Alt
>>>>>>>> key ;)
>>>>>>>> Same for {{...}} anyway
>>>>>>>>
>>>>>>>> Jacques
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> Thanks,
>>>>>>  Daniel Dekany
>>>>>>
>>>>>
>>>>
>>>> --
>>>> Thanks,
>>>>  Daniel Dekany
>>>>
>>>
>>
>> --
>> Thanks,
>>  Daniel Dekany
>>
>

-- 
Thanks,
 Daniel Dekany


Re: Alternative to ${exp}

Posted by Woonsan Ko <wo...@apache.org>.
Hi folks,

I'd like to bring this topic again to our attention.
It started totally my own mistake by being confused "Square bracket
tag syntax" (since 2.3.4) with the new "Square bracket interpolation
syntax" (since 2.3.28). [1]
Here's my example in another thread [2]:

1: [#ftl output_format="HTML"]
2: [#assign a=[1,2,3]]
3: [="Hello"]

#1 and #2 work as they are using the "Square bracket tag syntax", but
#3 doesn't by default (unless you change the configuration to use
"Square bracket interpolation" option).
So, it should have been like the following for intention:

1: [#ftl output_format="HTML"]
2: [#assign a=[1,2,3]]
3: ${"Hello"}

Now, I'm wondering if this kind of confusion could happen more to other people.
When they use square bracket tag syntax, they might be easily doing
the same thing for the interpolation like the first example.

One possible solution could be to use mustache as the default
alternative for interpolation like this:

1: [#ftl output_format="HTML"]
2: [#assign a=[1,2,3]]
3: {{"Hello"}}

As interpolation's alternative syntax is to use mustache, it might be
less confusing by not using the same syntax for both tags and
interpolation.
My old reason why avoiding mustache was, Javascript framework could
use both '${something}' [3] and '{{something}}' together. But also if
someones adopts mustache style JS frameworks, they might not use the
technique like [3]. Not sure though...

Another possible option could be to allow to change the interpolation
syntax to square bracket automatically as well if the first [#ftl ...]
is used like the tag syntax's automatic switching per template.
But I'm not sure what the implication is behind about this.

What do you think? Would my confusion be ignorable or do we need to
think about the alternative interpolation syntax again?

Kind regards,

Woonsan

[1] https://freemarker.apache.org/builds/fm2.3.28/dgui_misc_alternativesyntax.html
[2] https://lists.apache.org/thread.html/2372e673c5b8bd91150f7dd43319786dda8af38acdef87cd37f09ead@%3Cdev.freemarker.apache.org%3E
[3] https://en.wikipedia.org/wiki/String_interpolation#JavaScript

On Fri, Dec 15, 2017 at 5:28 AM, Daniel Dekany <dd...@apache.org> wrote:
> OK, so I would go for [=exp] (see the reason told in this thread). How
> acceptable is that guys?
>
>
> Tuesday, December 5, 2017, 11:56:59 AM, Woonsan Ko wrote:
>
>> On Mon, Dec 4, 2017 at 10:28 AM, Daniel Dekany <dd...@apache.org> wrote:
>>> Monday, December 4, 2017, 10:21:48 AM, Taher Alkhateeb wrote:
>>>
>>>> uh-huh, but I suspect maybe more collisions or need to escape
>>>> character in something like [this] or <this> than {{this}}. Anyway,
>>>> nothing critical IMO, only thinking out loud.
>>>
>>> But they were [=this] and <=this>, so the sequences that will clash
>>> are "[=" and "<=", which are quite rare. Oh wait... "<=" is not rare
>>> at all: "if (x <= y)". But "[=" still is. OK, so I guess at this point
>>> the two competitors left are {{exp}} and [=exp] (regardless of tag
>>> syntax).
>>
>> +1.00 on [=exp].
>> +0.49 on {{exp}}.
>>
>> :-D
>>
>> Many languages or templates allows ${exp}, including JavaScript. [1]
>> And, mustache is supported in many languages or templates, too. [2]
>> Therefore, I think there are more chances using both ${exp} and
>> {{exp}} in output we want to generate in the future.
>> The mustache style looks charming at the moment, but I wonder how its
>> charming can help for the original intention (to avoid any possible
>> collision in the output we want to generate by an alternative as much
>> as we can).
>>
>> Regards,
>>
>> Woonsan
>>
>> [1] https://en.wikipedia.org/wiki/String_interpolation
>> [2] https://mustache.github.io/
>>
>>>
>>>> On Mon, Dec 4, 2017 at 12:00 PM, Daniel Dekany <dd...@apache.org> wrote:
>>>>> Monday, December 4, 2017, 9:17:34 AM, Taher Alkhateeb wrote:
>>>>>
>>>>>> So maybe a safe bet (and a familiar one) is the mustache syntax.
>>>>>>
>>>>>> In addition to avoiding clashes it might help with a multi-chained
>>>>>> template. For example, we use FreeMarker extensively in Apache OFBiz
>>>>>> to generate many documents including XML. Now our XML documents might
>>>>>> contain some ${variable} that needs to be interpreted in the XML
>>>>>> parser, not the freemarker parser (without having to escape characters
>>>>>> everywhere)
>>>>>
>>>>> Though that also works with all the other proposal syntaxes as well.
>>>>>
>>>>>> On Mon, Dec 4, 2017 at 8:50 AM, Jacques Le Roux
>>>>>> <ja...@les7arts.com> wrote:
>>>>>>> Le 03/12/2017 à 22:06, Woonsan Ko a écrit :
>>>>>>>>
>>>>>>>> It is also most productive as no shift key is required.
>>>>>>>
>>>>>>> Depends on keyboard, for French keyboard type (azerty) you need to use Alt
>>>>>>> key ;)
>>>>>>> Same for {{...}} anyway
>>>>>>>
>>>>>>> Jacques
>>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Thanks,
>>>>>  Daniel Dekany
>>>>>
>>>>
>>>
>>> --
>>> Thanks,
>>>  Daniel Dekany
>>>
>>
>
> --
> Thanks,
>  Daniel Dekany
>

Re: Alternative to ${exp}

Posted by Jacques Le Roux <ja...@les7arts.com>.
I finally agree it sounds like the best

Jacques


Le 15/12/2017 à 11:28, Daniel Dekany a écrit :
> OK, so I would go for [=exp] (see the reason told in this thread). How
> acceptable is that guys?
>
>
> Tuesday, December 5, 2017, 11:56:59 AM, Woonsan Ko wrote:
>
>> On Mon, Dec 4, 2017 at 10:28 AM, Daniel Dekany <dd...@apache.org> wrote:
>>> Monday, December 4, 2017, 10:21:48 AM, Taher Alkhateeb wrote:
>>>
>>>> uh-huh, but I suspect maybe more collisions or need to escape
>>>> character in something like [this] or <this> than {{this}}. Anyway,
>>>> nothing critical IMO, only thinking out loud.
>>> But they were [=this] and <=this>, so the sequences that will clash
>>> are "[=" and "<=", which are quite rare. Oh wait... "<=" is not rare
>>> at all: "if (x <= y)". But "[=" still is. OK, so I guess at this point
>>> the two competitors left are {{exp}} and [=exp] (regardless of tag
>>> syntax).
>> +1.00 on [=exp].
>> +0.49 on {{exp}}.
>>
>> :-D
>>
>> Many languages or templates allows ${exp}, including JavaScript. [1]
>> And, mustache is supported in many languages or templates, too. [2]
>> Therefore, I think there are more chances using both ${exp} and
>> {{exp}} in output we want to generate in the future.
>> The mustache style looks charming at the moment, but I wonder how its
>> charming can help for the original intention (to avoid any possible
>> collision in the output we want to generate by an alternative as much
>> as we can).
>>
>> Regards,
>>
>> Woonsan
>>
>> [1] https://en.wikipedia.org/wiki/String_interpolation
>> [2] https://mustache.github.io/
>>
>>>> On Mon, Dec 4, 2017 at 12:00 PM, Daniel Dekany <dd...@apache.org> wrote:
>>>>> Monday, December 4, 2017, 9:17:34 AM, Taher Alkhateeb wrote:
>>>>>
>>>>>> So maybe a safe bet (and a familiar one) is the mustache syntax.
>>>>>>
>>>>>> In addition to avoiding clashes it might help with a multi-chained
>>>>>> template. For example, we use FreeMarker extensively in Apache OFBiz
>>>>>> to generate many documents including XML. Now our XML documents might
>>>>>> contain some ${variable} that needs to be interpreted in the XML
>>>>>> parser, not the freemarker parser (without having to escape characters
>>>>>> everywhere)
>>>>> Though that also works with all the other proposal syntaxes as well.
>>>>>
>>>>>> On Mon, Dec 4, 2017 at 8:50 AM, Jacques Le Roux
>>>>>> <ja...@les7arts.com> wrote:
>>>>>>> Le 03/12/2017 à 22:06, Woonsan Ko a écrit :
>>>>>>>> It is also most productive as no shift key is required.
>>>>>>> Depends on keyboard, for French keyboard type (azerty) you need to use Alt
>>>>>>> key ;)
>>>>>>> Same for {{...}} anyway
>>>>>>>
>>>>>>> Jacques
>>>>>>>
>>>>> --
>>>>> Thanks,
>>>>>   Daniel Dekany
>>>>>
>>> --
>>> Thanks,
>>>   Daniel Dekany
>>>


Re: Alternative to ${exp}

Posted by Daniel Dekany <dd...@apache.org>.
OK, so I would go for [=exp] (see the reason told in this thread). How
acceptable is that guys?


Tuesday, December 5, 2017, 11:56:59 AM, Woonsan Ko wrote:

> On Mon, Dec 4, 2017 at 10:28 AM, Daniel Dekany <dd...@apache.org> wrote:
>> Monday, December 4, 2017, 10:21:48 AM, Taher Alkhateeb wrote:
>>
>>> uh-huh, but I suspect maybe more collisions or need to escape
>>> character in something like [this] or <this> than {{this}}. Anyway,
>>> nothing critical IMO, only thinking out loud.
>>
>> But they were [=this] and <=this>, so the sequences that will clash
>> are "[=" and "<=", which are quite rare. Oh wait... "<=" is not rare
>> at all: "if (x <= y)". But "[=" still is. OK, so I guess at this point
>> the two competitors left are {{exp}} and [=exp] (regardless of tag
>> syntax).
>
> +1.00 on [=exp].
> +0.49 on {{exp}}.
>
> :-D
>
> Many languages or templates allows ${exp}, including JavaScript. [1]
> And, mustache is supported in many languages or templates, too. [2]
> Therefore, I think there are more chances using both ${exp} and
> {{exp}} in output we want to generate in the future.
> The mustache style looks charming at the moment, but I wonder how its
> charming can help for the original intention (to avoid any possible
> collision in the output we want to generate by an alternative as much
> as we can).
>
> Regards,
>
> Woonsan
>
> [1] https://en.wikipedia.org/wiki/String_interpolation
> [2] https://mustache.github.io/
>
>>
>>> On Mon, Dec 4, 2017 at 12:00 PM, Daniel Dekany <dd...@apache.org> wrote:
>>>> Monday, December 4, 2017, 9:17:34 AM, Taher Alkhateeb wrote:
>>>>
>>>>> So maybe a safe bet (and a familiar one) is the mustache syntax.
>>>>>
>>>>> In addition to avoiding clashes it might help with a multi-chained
>>>>> template. For example, we use FreeMarker extensively in Apache OFBiz
>>>>> to generate many documents including XML. Now our XML documents might
>>>>> contain some ${variable} that needs to be interpreted in the XML
>>>>> parser, not the freemarker parser (without having to escape characters
>>>>> everywhere)
>>>>
>>>> Though that also works with all the other proposal syntaxes as well.
>>>>
>>>>> On Mon, Dec 4, 2017 at 8:50 AM, Jacques Le Roux
>>>>> <ja...@les7arts.com> wrote:
>>>>>> Le 03/12/2017 à 22:06, Woonsan Ko a écrit :
>>>>>>>
>>>>>>> It is also most productive as no shift key is required.
>>>>>>
>>>>>> Depends on keyboard, for French keyboard type (azerty) you need to use Alt
>>>>>> key ;)
>>>>>> Same for {{...}} anyway
>>>>>>
>>>>>> Jacques
>>>>>>
>>>>>
>>>>
>>>> --
>>>> Thanks,
>>>>  Daniel Dekany
>>>>
>>>
>>
>> --
>> Thanks,
>>  Daniel Dekany
>>
>

-- 
Thanks,
 Daniel Dekany


Re: Alternative to ${exp}

Posted by Woonsan Ko <wo...@apache.org>.
On Mon, Dec 4, 2017 at 10:28 AM, Daniel Dekany <dd...@apache.org> wrote:
> Monday, December 4, 2017, 10:21:48 AM, Taher Alkhateeb wrote:
>
>> uh-huh, but I suspect maybe more collisions or need to escape
>> character in something like [this] or <this> than {{this}}. Anyway,
>> nothing critical IMO, only thinking out loud.
>
> But they were [=this] and <=this>, so the sequences that will clash
> are "[=" and "<=", which are quite rare. Oh wait... "<=" is not rare
> at all: "if (x <= y)". But "[=" still is. OK, so I guess at this point
> the two competitors left are {{exp}} and [=exp] (regardless of tag
> syntax).

+1.00 on [=exp].
+0.49 on {{exp}}.

:-D

Many languages or templates allows ${exp}, including JavaScript. [1]
And, mustache is supported in many languages or templates, too. [2]
Therefore, I think there are more chances using both ${exp} and
{{exp}} in output we want to generate in the future.
The mustache style looks charming at the moment, but I wonder how its
charming can help for the original intention (to avoid any possible
collision in the output we want to generate by an alternative as much
as we can).

Regards,

Woonsan

[1] https://en.wikipedia.org/wiki/String_interpolation
[2] https://mustache.github.io/

>
>> On Mon, Dec 4, 2017 at 12:00 PM, Daniel Dekany <dd...@apache.org> wrote:
>>> Monday, December 4, 2017, 9:17:34 AM, Taher Alkhateeb wrote:
>>>
>>>> So maybe a safe bet (and a familiar one) is the mustache syntax.
>>>>
>>>> In addition to avoiding clashes it might help with a multi-chained
>>>> template. For example, we use FreeMarker extensively in Apache OFBiz
>>>> to generate many documents including XML. Now our XML documents might
>>>> contain some ${variable} that needs to be interpreted in the XML
>>>> parser, not the freemarker parser (without having to escape characters
>>>> everywhere)
>>>
>>> Though that also works with all the other proposal syntaxes as well.
>>>
>>>> On Mon, Dec 4, 2017 at 8:50 AM, Jacques Le Roux
>>>> <ja...@les7arts.com> wrote:
>>>>> Le 03/12/2017 à 22:06, Woonsan Ko a écrit :
>>>>>>
>>>>>> It is also most productive as no shift key is required.
>>>>>
>>>>> Depends on keyboard, for French keyboard type (azerty) you need to use Alt
>>>>> key ;)
>>>>> Same for {{...}} anyway
>>>>>
>>>>> Jacques
>>>>>
>>>>
>>>
>>> --
>>> Thanks,
>>>  Daniel Dekany
>>>
>>
>
> --
> Thanks,
>  Daniel Dekany
>

Re: Alternative to ${exp}

Posted by Daniel Dekany <dd...@apache.org>.
Monday, December 4, 2017, 10:21:48 AM, Taher Alkhateeb wrote:

> uh-huh, but I suspect maybe more collisions or need to escape
> character in something like [this] or <this> than {{this}}. Anyway,
> nothing critical IMO, only thinking out loud.

But they were [=this] and <=this>, so the sequences that will clash
are "[=" and "<=", which are quite rare. Oh wait... "<=" is not rare
at all: "if (x <= y)". But "[=" still is. OK, so I guess at this point
the two competitors left are {{exp}} and [=exp] (regardless of tag
syntax).

> On Mon, Dec 4, 2017 at 12:00 PM, Daniel Dekany <dd...@apache.org> wrote:
>> Monday, December 4, 2017, 9:17:34 AM, Taher Alkhateeb wrote:
>>
>>> So maybe a safe bet (and a familiar one) is the mustache syntax.
>>>
>>> In addition to avoiding clashes it might help with a multi-chained
>>> template. For example, we use FreeMarker extensively in Apache OFBiz
>>> to generate many documents including XML. Now our XML documents might
>>> contain some ${variable} that needs to be interpreted in the XML
>>> parser, not the freemarker parser (without having to escape characters
>>> everywhere)
>>
>> Though that also works with all the other proposal syntaxes as well.
>>
>>> On Mon, Dec 4, 2017 at 8:50 AM, Jacques Le Roux
>>> <ja...@les7arts.com> wrote:
>>>> Le 03/12/2017 à 22:06, Woonsan Ko a écrit :
>>>>>
>>>>> It is also most productive as no shift key is required.
>>>>
>>>> Depends on keyboard, for French keyboard type (azerty) you need to use Alt
>>>> key ;)
>>>> Same for {{...}} anyway
>>>>
>>>> Jacques
>>>>
>>>
>>
>> --
>> Thanks,
>>  Daniel Dekany
>>
>

-- 
Thanks,
 Daniel Dekany


Re: Alternative to ${exp}

Posted by Taher Alkhateeb <sl...@gmail.com>.
uh-huh, but I suspect maybe more collisions or need to escape
character in something like [this] or <this> than {{this}}. Anyway,
nothing critical IMO, only thinking out loud.

On Mon, Dec 4, 2017 at 12:00 PM, Daniel Dekany <dd...@apache.org> wrote:
> Monday, December 4, 2017, 9:17:34 AM, Taher Alkhateeb wrote:
>
>> So maybe a safe bet (and a familiar one) is the mustache syntax.
>>
>> In addition to avoiding clashes it might help with a multi-chained
>> template. For example, we use FreeMarker extensively in Apache OFBiz
>> to generate many documents including XML. Now our XML documents might
>> contain some ${variable} that needs to be interpreted in the XML
>> parser, not the freemarker parser (without having to escape characters
>> everywhere)
>
> Though that also works with all the other proposal syntaxes as well.
>
>> On Mon, Dec 4, 2017 at 8:50 AM, Jacques Le Roux
>> <ja...@les7arts.com> wrote:
>>> Le 03/12/2017 à 22:06, Woonsan Ko a écrit :
>>>>
>>>> It is also most productive as no shift key is required.
>>>
>>> Depends on keyboard, for French keyboard type (azerty) you need to use Alt
>>> key ;)
>>> Same for {{...}} anyway
>>>
>>> Jacques
>>>
>>
>
> --
> Thanks,
>  Daniel Dekany
>

Re: Alternative to ${exp}

Posted by Daniel Dekany <dd...@apache.org>.
Monday, December 4, 2017, 9:17:34 AM, Taher Alkhateeb wrote:

> So maybe a safe bet (and a familiar one) is the mustache syntax.
>
> In addition to avoiding clashes it might help with a multi-chained
> template. For example, we use FreeMarker extensively in Apache OFBiz
> to generate many documents including XML. Now our XML documents might
> contain some ${variable} that needs to be interpreted in the XML
> parser, not the freemarker parser (without having to escape characters
> everywhere)

Though that also works with all the other proposal syntaxes as well.

> On Mon, Dec 4, 2017 at 8:50 AM, Jacques Le Roux
> <ja...@les7arts.com> wrote:
>> Le 03/12/2017 à 22:06, Woonsan Ko a écrit :
>>>
>>> It is also most productive as no shift key is required.
>>
>> Depends on keyboard, for French keyboard type (azerty) you need to use Alt
>> key ;)
>> Same for {{...}} anyway
>>
>> Jacques
>>
>

-- 
Thanks,
 Daniel Dekany


Re: Alternative to ${exp}

Posted by Taher Alkhateeb <sl...@gmail.com>.
So maybe a safe bet (and a familiar one) is the mustache syntax.

In addition to avoiding clashes it might help with a multi-chained
template. For example, we use FreeMarker extensively in Apache OFBiz
to generate many documents including XML. Now our XML documents might
contain some ${variable} that needs to be interpreted in the XML
parser, not the freemarker parser (without having to escape characters
everywhere)

On Mon, Dec 4, 2017 at 8:50 AM, Jacques Le Roux
<ja...@les7arts.com> wrote:
> Le 03/12/2017 à 22:06, Woonsan Ko a écrit :
>>
>> It is also most productive as no shift key is required.
>
> Depends on keyboard, for French keyboard type (azerty) you need to use Alt
> key ;)
> Same for {{...}} anyway
>
> Jacques
>

Re: Alternative to ${exp}

Posted by Jacques Le Roux <ja...@les7arts.com>.
Le 03/12/2017 à 22:06, Woonsan Ko a écrit :
> It is also most productive as no shift key is required.
Depends on keyboard, for French keyboard type (azerty) you need to use Alt key ;)
Same for {{...}} anyway

Jacques