Change in macro invocation positional arglists (COMMAN) in SVN HEAD?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Change in macro invocation positional arglists (COMMAN) in SVN HEAD?

Leigh L. Klotz, Jr.
I've pulled SVN head to start familiarizing myself with it.  I've done a
bit of reading of threads on this list and todos and checkins and still
have a question.

It looks like position arglists for macro invocation now require commas.

That is,
 <@foo x y z>
which used to work in 2.3.12 is now
 <@foo x, y, z>

Looking in FMParser.jj, I see UnifiedMacroTransform() uses ArgsList()
which does an EQUALS lookahead for either NamedArgsList() or
PositionalArgsList(), and PositionalArgsList() requires <COMMA>.

Is this change intentional?  It seems like it will trip up existing
templates.

Leigh.



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Change in macro invocation positional arglists (COMMAN) in SVN HEAD?

revusky
Klotz, Leigh wrote:

> I've pulled SVN head to start familiarizing myself with it.  I've done a
> bit of reading of threads on this list and todos and checkins and still
> have a question.
>
> It looks like position arglists for macro invocation now require commas.
>
> That is,
>  <@foo x y z>
> which used to work in 2.3.12 is now
>  <@foo x, y, z>
>
> Looking in FMParser.jj, I see UnifiedMacroTransform() uses ArgsList()
> which does an EQUALS lookahead for either NamedArgsList() or
> PositionalArgsList(), and PositionalArgsList() requires <COMMA>.
>
> Is this change intentional?

Yes, I think it was. It was me who did that, and, to be honest, I think
I'd forgotten that and maybe I was talking in the other thread like the
commas were optional in this case. Well, they definitely are optional in
a named parameter list, since that whole syntax kind of exists by
analogy with XML/HTML.

Well, here's the situation. Our docs and examples always have had commas
in between the arguments in positional args lists. At some point,
probably due to half-baked thinking, I made them optional in the
grammar, which, as you see, amounts to changing <COMMA> to [<COMMA>].

It's really too loose because x [y] becomes ambiguous, is it one
argument x[y] or is it two arguments x, [y]. Of course, it parses it as
x[y] which surely violates the principle of least surprise. You now,
<@foo x y>  is parsed as invoking foo on two arguments, x and y, and if
you make the second argument a one-element sequence, you have <@foo x
[y]> being parsed as invoking foo on the single argument x[y].

The freemarker 1.x invocation syntax was

<call foo(arg1, arg2...argn)>

FreeMarker 1.x had a hand-written parser and I rewrote it a long time
ago, like late 2001, using javacc and actually that was the first time I
had ever used a parser generator. So my first step was to just replicate
what the hand-written parser did. Of course, soon after that, since
having a javacc grammar makes it so easy to muck around, I started
playing with certain changes. Anyway, I think fairly early in that
process, I made the parentheses optional, so you could write <call foo
arg1, arg2...>. And that, I think, is pretty unambiguously right and
proper, because the foo(arg1, arg2...) was by analogy with languages
like C and java and so forth where you need the parentheses (in
particular the closing ')') to delimit it from the stuff around it.
However, in this case, the < and > are already delimiting the statement
perfectly well, so requiring ( and ) is just visual junk. Anyway,  I
guess at some point, I made the incorrect logical leap that the commas
also weren't necessary and made them optional, but that was almost
certainly a mistake, since it causes the aforementioned problem with
whether x [y] is (x, [y]) or (x[y]). Same thing with x (y). Is that x(y)
or x, (y) ?

So I did this when I was a parser-writing newbie and it was there and
for a long time, I was vaguely aware that this was too loosy goosy. Of
course, once you're accepting that input, you're nervous about changing
it back and breaking people's templates. Anyway, at some later point, I
grepped over our docs and examples, and realized we had never told
anybody (even implicitly by example) that the commas were optional, so I
changed them back to being required in the 2.4 trunk. And I figured that
if enough people screamed blue murder after an initial 2.4 preview
release, I could change <COMMA> back to [<COMMA>].

I don't know what the proper emoticons are to convey that I feel some
embarassment recounting all of this. You are likely a formally trained
computer scientist and are horrified by a language defined by its
implementation in this kind of ad hoc way...

So there it is. Of course, from the POV of describing the language, we
could perfectly well say that the commas are not required, but there are
constructs like x [y] (two args) that can only be expressed with the
comma in the middle because otherwise it will be parsed as a single
expression x[y]...

Meanwhile, anybody who ran into this in practice, they would probably
just figure it was their fault, they left out the comma, since if they
consulted the docs and examples, we never told anybody that the commas
were optional...

> It seems like it will trip up existing
> templates.

Yes, it likely would, since even though we never said anywhere that the
commas were optional and that you could write <@a b c /> it's very
(extremely?) likely that plenty of people happened to notice that you
could and started taking advantage of it.

Oh, and this doesn't affect our ability to distinguish between a
positional list and named args list, since the lookahead we use is
<IDENTIFIER> <EQUALS>. If the args list doesn't start with those two
tokens, it is assumed to be a positional args list, i.e. FWIW, it
doesn't look for the comma...

JR

>
> Leigh.
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save $100.
> Use priority code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> FreeMarker-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/freemarker-devel
>


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Change in macro invocation positional arglists (COMMAN) in SVN HEAD?

Leigh L. Klotz, Jr.
JR,

I'm trying to learn FM, support it, and extend it, all at the same time,
so please forgive me if I come up short.  I'll try not to be a burden
before I can become a help, which I hope I can in the future.

As for taste and parsers and computer science, nothing is so horrible as
code I wrote 6 months ago.

I now see that the keyword syntax is in
http://www.freemarker.org/docs/ref_directive_macro.html

and the position syntax is in
http://www.freemarker.org/docs/ref_directive_userDefined.html

I'm certainly new enough to the FTL community that I can have no
recommendation one way or another on support, non-support,
warning/deprecation, etc.  So I just had the somewhat selfish motivation
at the moment of deciding whether to put in commas.

So, I will go do that now.

Thank you,
Leigh.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Change in macro invocation positional arglists (COMMAN) in SVN HEAD?

revusky
Klotz, Leigh wrote:
> JR,
>
> I'm trying to learn FM, support it, and extend it, all at the same time,
> so please forgive me if I come up short.  I'll try not to be a burden
> before I can become a help, which I hope I can in the future.

Well, there's no need to worry about being a burden or anything. Feel
free to ask however many questions you want.

Most questions will probably have a briefer answer. I ended up writing a
long-winded response mainly because it's sort of a screwed-up corner of
things.

I guess the shorter answer is just that the positional args are comma
delimited, that's what our docs and examples say and have always said,
but the implementation didn't require them for a long time, and the SVN
head is correcting that situation.

(Though, if there turns out to be a big uproar, the above line may
shift, but you can't possibly go wrong putting in the commas, so the
answer, pragmatically speaking, is clearly to put them in. :-))

Cheers,

JR

>
> As for taste and parsers and computer science, nothing is so horrible as
> code I wrote 6 months ago.
>
> I now see that the keyword syntax is in
> http://www.freemarker.org/docs/ref_directive_macro.html
>
> and the position syntax is in
> http://www.freemarker.org/docs/ref_directive_userDefined.html
>
> I'm certainly new enough to the FTL community that I can have no
> recommendation one way or another on support, non-support,
> warning/deprecation, etc.  So I just had the somewhat selfish motivation
> at the moment of deciding whether to put in commas.
>
> So, I will go do that now.
>
> Thank you,
> Leigh.
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save $100.
> Use priority code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> FreeMarker-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/freemarker-devel
>


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Change in macro invocation positional arglists (COMMAN) in SVN HEAD?

Daniel Dekany
Saturday, April 26, 2008, 1:51:44 AM, Jonathan Revusky wrote:

> Klotz, Leigh wrote:
>> JR,
>>
>> I'm trying to learn FM, support it, and extend it, all at the same time,
>> so please forgive me if I come up short.  I'll try not to be a burden
>> before I can become a help, which I hope I can in the future.
>
> Well, there's no need to worry about being a burden or anything. Feel
> free to ask however many questions you want.
>
> Most questions will probably have a briefer answer.

Except if *you* answer it... :>

> I ended up writing a long-winded response mainly because it's sort
> of a screwed-up corner of things.

Err... this thing wasn't on my "NBC changes in 2.4" list. Could be my
mistake, or that you didn't announced this change in a separate mail.
I don't know. In any case, please announce all NBC changes in a
*separate* mail on the devel list, with "alarming" subject line.
(Damn, I start to feel myself as some kind of local police on FM
land... And then I have to add the Hungarians are mostly
dislike/despite police man.)

> I guess the shorter answer is just that the positional args are comma
> delimited, that's what our docs and examples say and have always said,
> but the implementation didn't require them for a long time, and the SVN
> head is correcting that situation.
>
> (Though, if there turns out to be a big uproar,

Oh no... riots in front of the VSS HQ again? (Just in case hungarians
will be there, "Elkúrtad!" = "You have bungled it!", on a rude way
anyway. Jesus, is this 5 words in English?)

> the above line may shift, but you can't possibly go wrong putting in
> the commas, so the answer, pragmatically speaking, is clearly to put
> them in. :-))
>
> Cheers,
>
> JR
>
>>
>> As for taste and parsers and computer science, nothing is so horrible as
>> code I wrote 6 months ago.
>>
>> I now see that the keyword syntax is in
>> http://www.freemarker.org/docs/ref_directive_macro.html
>>
>> and the position syntax is in
>> http://www.freemarker.org/docs/ref_directive_userDefined.html
>>
>> I'm certainly new enough to the FTL community that I can have no
>> recommendation one way or another on support, non-support,
>> warning/deprecation, etc.  So I just had the somewhat selfish motivation
>> at the moment of deciding whether to put in commas.
>>
>> So, I will go do that now.
>>
>> Thank you,
>> Leigh.

--
Best regards,
 Daniel Dekany


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Change in macro invocation positional arglists (COMMAN) in SVN HEAD?

Denis Bredelet
In reply to this post by revusky
 
On Saturday, April 26, 2008, at 12:15AM, "Jonathan Revusky" <[hidden email]> wrote:

>Klotz, Leigh wrote:
>> I've pulled SVN head to start familiarizing myself with it.  I've done a
>> bit of reading of threads on this list and todos and checkins and still
>> have a question.
>>
>> It looks like position arglists for macro invocation now require commas.
>>
>> That is,
>>  <@foo x y z>
>> which used to work in 2.3.12 is now
>>  <@foo x, y, z>
>>
>> Looking in FMParser.jj, I see UnifiedMacroTransform() uses ArgsList()
>> which does an EQUALS lookahead for either NamedArgsList() or
>> PositionalArgsList(), and PositionalArgsList() requires <COMMA>.
>>
>> Is this change intentional?
>
>Yes, I think it was. It was me who did that, and, to be honest, I think
>I'd forgotten that and maybe I was talking in the other thread like the
>commas were optional in this case. Well, they definitely are optional in
>a named parameter list, since that whole syntax kind of exists by
>analogy with XML/HTML.
>
>Well, here's the situation. Our docs and examples always have had commas
>in between the arguments in positional args lists. At some point,

Actually....
Do you also require commas between loop variables?

Because they are missing here (near the bottom of the page):
http://freemarker.org/docs/ref_directive_macro.html

The example does not compile in 2.3.

-- Denis.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Change in macro invocation positional arglists (COMMAN) in SVN HEAD?

Daniel Dekany
Sunday, April 27, 2008, 1:21:32 AM, Denis Bredelet wrote:

>  
> On Saturday, April 26, 2008, at 12:15AM, "Jonathan Revusky" <[hidden email]> wrote:
>>Klotz, Leigh wrote:
>>> I've pulled SVN head to start familiarizing myself with it.  I've done a
>>> bit of reading of threads on this list and todos and checkins and still
>>> have a question.
>>>
>>> It looks like position arglists for macro invocation now require commas.
>>>
>>> That is,
>>>  <@foo x y z>
>>> which used to work in 2.3.12 is now
>>>  <@foo x, y, z>
>>>
>>> Looking in FMParser.jj, I see UnifiedMacroTransform() uses ArgsList()
>>> which does an EQUALS lookahead for either NamedArgsList() or
>>> PositionalArgsList(), and PositionalArgsList() requires <COMMA>.
>>>
>>> Is this change intentional?
>>
>>Yes, I think it was. It was me who did that, and, to be honest, I think
>>I'd forgotten that and maybe I was talking in the other thread like the
>>commas were optional in this case. Well, they definitely are optional in
>>a named parameter list, since that whole syntax kind of exists by
>>analogy with XML/HTML.
>>
>>Well, here's the situation. Our docs and examples always have had commas
>>in between the arguments in positional args lists. At some point,
>
> Actually....
> Do you also require commas between loop variables?

I think we do.

> Because they are missing here (near the bottom of the page):
> http://freemarker.org/docs/ref_directive_macro.html

Ouch... fixed it in the SVN.

> The example does not compile in 2.3.
>
> -- Denis.
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save $100.
> Use priority code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> FreeMarker-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/freemarker-devel

--
Best regards,
 Daniel Dekany


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Change in macro invocation positional arglists (COMMAN) in SVN HEAD?

revusky
In reply to this post by Daniel Dekany
Daniel Dekany wrote:

> Saturday, April 26, 2008, 1:51:44 AM, Jonathan Revusky wrote:
>
>> Klotz, Leigh wrote:
>>> JR,
>>>
>>> I'm trying to learn FM, support it, and extend it, all at the same time,
>>> so please forgive me if I come up short.  I'll try not to be a burden
>>> before I can become a help, which I hope I can in the future.
>> Well, there's no need to worry about being a burden or anything. Feel
>> free to ask however many questions you want.
>>
>> Most questions will probably have a briefer answer.
>
> Except if *you* answer it... :>
>
>> I ended up writing a long-winded response mainly because it's sort
>> of a screwed-up corner of things.
>
> Err... this thing wasn't on my "NBC changes in 2.4" list. Could be my
> mistake, or that you didn't announced this change in a separate mail.
> I don't know. In any case, please announce all NBC changes in a
> *separate* mail on the devel list, with "alarming" subject line.
> (Damn, I start to feel myself as some kind of local police on FM
> land... And then I have to add the Hungarians are mostly
> dislike/despite police man.)

You know, this has given me cause to think about this more over the
weekend, and.... (ducks and runs for cover) I think I'm going to make
the commas optional in those spots again.

I was trying to think about the pros and the cons and I think finally,
for us, it was better to have the commas be optional.

The main thing against having them be optional is that it creates an
ambiguity which could lead people to make mistakes in certain
situations, as in:

<@foo x [y]/>

where the intention was x, [y] but it gets parsed as the single arg
x[y]. So, obviously, if your intent was to pass in those two arguments,
the comma is not optional. But finally, that does not strike me as a
dangerous thing or anything. For starters, most of the time, the code
would just fail because macro foo expects two arguments, and you are
passing it one, so you would be alerted to the mistake immediately that
way. Of course, the second argument could be optional, in which case
passing only one argument would be okay, except that, even in that case,
the objective likelihood that x[y] actually evaluates to something when
the intention was to write x, [y] is very very low.

So, I think that if somebody mistakenly writes x [y] or some such thing
without the comma in the case where the comma really is necessary to
disambiguate, it will be a cold day in hell when he won't be alerted to
the error pretty much immediately.

And, then, of course, there are all these cases where the comma is
simply unneeded.

<@foo x y z/>

<@foo 1 2 x-y/>

and so on. I really think that suddenly requiring the commas in all
these situations going from 2.3 to 2.4 is a bit much. It's surely the
kind of nitpicking thing that has the potential to piss people off.

The other aspect of things is that we have kind of an unstated design
goal of having a syntax that, without being valid XML or anything, has a
sort of familiar feel to people who know markup.

Finally, I don't think that the current de facto situation in 2.3, that
the commas are optional unless they really are needed to disambiguate,
is particularly bad, and my current feeling is that we should keep it
that way.

JR


>
>> I guess the shorter answer is just that the positional args are comma
>> delimited, that's what our docs and examples say and have always said,
>> but the implementation didn't require them for a long time, and the SVN
>> head is correcting that situation.
>>
>> (Though, if there turns out to be a big uproar,
>
> Oh no... riots in front of the VSS HQ again? (Just in case hungarians
> will be there, "Elkúrtad!" = "You have bungled it!", on a rude way
> anyway. Jesus, is this 5 words in English?)
>
>> the above line may shift, but you can't possibly go wrong putting in
>> the commas, so the answer, pragmatically speaking, is clearly to put
>> them in. :-))
>>
>> Cheers,
>>
>> JR
>>
>>> As for taste and parsers and computer science, nothing is so horrible as
>>> code I wrote 6 months ago.
>>>
>>> I now see that the keyword syntax is in
>>> http://www.freemarker.org/docs/ref_directive_macro.html
>>>
>>> and the position syntax is in
>>> http://www.freemarker.org/docs/ref_directive_userDefined.html
>>>
>>> I'm certainly new enough to the FTL community that I can have no
>>> recommendation one way or another on support, non-support,
>>> warning/deprecation, etc.  So I just had the somewhat selfish motivation
>>> at the moment of deciding whether to put in commas.
>>>
>>> So, I will go do that now.
>>>
>>> Thank you,
>>> Leigh.
>



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Change in macro invocation positional arglists (COMMAN) in SVN HEAD?

revusky
In reply to this post by Denis Bredelet
Denis Bredelet wrote:

>  
> On Saturday, April 26, 2008, at 12:15AM, "Jonathan Revusky" <[hidden email]> wrote:
>> Klotz, Leigh wrote:
>>> I've pulled SVN head to start familiarizing myself with it.  I've done a
>>> bit of reading of threads on this list and todos and checkins and still
>>> have a question.
>>>
>>> It looks like position arglists for macro invocation now require commas.
>>>
>>> That is,
>>>  <@foo x y z>
>>> which used to work in 2.3.12 is now
>>>  <@foo x, y, z>
>>>
>>> Looking in FMParser.jj, I see UnifiedMacroTransform() uses ArgsList()
>>> which does an EQUALS lookahead for either NamedArgsList() or
>>> PositionalArgsList(), and PositionalArgsList() requires <COMMA>.
>>>
>>> Is this change intentional?
>> Yes, I think it was. It was me who did that, and, to be honest, I think
>> I'd forgotten that and maybe I was talking in the other thread like the
>> commas were optional in this case. Well, they definitely are optional in
>> a named parameter list, since that whole syntax kind of exists by
>> analogy with XML/HTML.
>>
>> Well, here's the situation. Our docs and examples always have had commas
>> in between the arguments in positional args lists. At some point,
>
> Actually....
> Do you also require commas between loop variables?

If you mean this,

<@repeat count=4 ; c halfc last>

then that's a different case. Because the c, halfc, and last declare
dummy variables used in the loop and they have to be identifiers, so
there is no particular reason to require commas in between them, since
the whitespace delimits them unambiguously already.

There's only an issue when you are passing in actual parameter values,
which can be any expression, because then you have ambiguities, like is
x (y+z) the invocation of method x with argument y, or two arguments, x
and (y+z). Stuff like that.

But anyway, I'm now thinking that 2.4 will go back to the commas being
optional. (Or perhaps more precisely, only required when.... required. :-))

JR

>
> Because they are missing here (near the bottom of the page):
> http://freemarker.org/docs/ref_directive_macro.html
>
> The example does not compile in 2.3.
>
> -- Denis.
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save $100.
> Use priority code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Change in macro invocation positional arglists (COMMAN) in SVN HEAD?

Daniel Dekany
In reply to this post by revusky
Monday, April 28, 2008, 7:26:17 PM, Jonathan Revusky wrote:

> Daniel Dekany wrote:
>> Saturday, April 26, 2008, 1:51:44 AM, Jonathan Revusky wrote:
>>
>>> Klotz, Leigh wrote:
>>>> JR,
>>>>
>>>> I'm trying to learn FM, support it, and extend it, all at the same time,
>>>> so please forgive me if I come up short.  I'll try not to be a burden
>>>> before I can become a help, which I hope I can in the future.
>>> Well, there's no need to worry about being a burden or anything. Feel
>>> free to ask however many questions you want.
>>>
>>> Most questions will probably have a briefer answer.
>>
>> Except if *you* answer it... :>
>>
>>> I ended up writing a long-winded response mainly because it's sort
>>> of a screwed-up corner of things.
>>
>> Err... this thing wasn't on my "NBC changes in 2.4" list. Could be my
>> mistake, or that you didn't announced this change in a separate mail.
>> I don't know. In any case, please announce all NBC changes in a
>> *separate* mail on the devel list, with "alarming" subject line.
>> (Damn, I start to feel myself as some kind of local police on FM
>> land... And then I have to add the Hungarians are mostly
>> dislike/despite police man.)
>
> You know, this has given me cause to think about this more over the
> weekend, and.... (ducks and runs for cover) I think I'm going to make
> the commas optional in those spots again.
>
> I was trying to think about the pros and the cons and I think finally,
> for us, it was better to have the commas be optional.
>
> The main thing against having them be optional is that it creates an
> ambiguity which could lead people to make mistakes in certain
> situations, as in:
>
> <@foo x [y]/>
>
> where the intention was x, [y] but it gets parsed as the single arg
> x[y]. So, obviously, if your intent was to pass in those two arguments,
> the comma is not optional. But finally, that does not strike me as a
> dangerous thing or anything. For starters, most of the time, the code
> would just fail because macro foo expects two arguments, and you are
> passing it one, so you would be alerted to the mistake immediately that
> way. Of course, the second argument could be optional, in which case
> passing only one argument would be okay, except that, even in that case,
> the objective likelihood that x[y] actually evaluates to something when
> the intention was to write x, [y] is very very low.
>
> So, I think that if somebody mistakenly writes x [y] or some such thing
> without the comma in the case where the comma really is necessary to
> disambiguate, it will be a cold day in hell when he won't be alerted to
> the error pretty much immediately.
>
> And, then, of course, there are all these cases where the comma is
> simply unneeded.
>
> <@foo x y z/>
>
> <@foo 1 2 x-y/>
>
> and so on. I really think that suddenly requiring the commas in all
> these situations going from 2.3 to 2.4 is a bit much. It's surely the
> kind of nitpicking thing that has the potential to piss people off.
>
> The other aspect of things is that we have kind of an unstated design
> goal of having a syntax that, without being valid XML or anything, has a
> sort of familiar feel to people who know markup.
>
> Finally, I don't think that the current de facto situation in 2.3, that
> the commas are optional unless they really are needed to disambiguate,
> is particularly bad, and my current feeling is that we should keep it
> that way.

OK. But I still rather don't documenting that the comma can be
omitted. I see this as a quirk left there for BC.

> JR

--
Best regards,
 Daniel Dekany


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel