Re: weird macro params issue
Attila Szegedi <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
On 2008.05.02., at 19:43, Jonathan Revusky wrote:
> I misspoke above. I meant, here, that it would be better if it always
> worked than if it worked some of the time and failed other times. I
> mean, it should always work or always fail... :-)
>
> JR
> but I think I would just tend towards it always failing.
What's funny is that I have an idea how to make it work whenever
possible, but making it always fail seems less trivial, as you need to
prove none of the default expressions actually depend on other
parameters; i.e. you could have an argument list of "a
b=someGlobalVar[a]"; you'd need to analyze the full default expression
of 'b' for any occurrence of 'a', and then it can be even more hidden,
like b=someGlobalVar[.local["a"]]; you get the idea. The "always work"
would however cover even these horrors naturally :-)
It would have one last issue with not being deterministic with
existence built-ins, i.e.
[#macro x a b=a c=b?default("foo")]
${c}
[/#macro]
[@x "bar"/]
would nondeterministically print either "foo" or "bar", which can be
further rectified by always doing the evaluation in declaration order
within every iteration. I guess that would have us covered... I *know*
it'd be a godawful practice to use an existence builtin in defaulted
arg list because the engine doesn't allow you to have any param be
undefined, but these are still corner cases allowed by the language,
so we'd better address them to be deterministic...
Attila.
-------------------------------------------------------------------------
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