Re: weird macro params issue
Attila Szegedi <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Ok, I have this working on 2.3 branch. Getting it to work in 2.4 seems
to be a bit more involved - actually, I just need to familiarize
myself a bit with it first. Jonathan made few assumptions in the code
that default expressions will always evaluate at first; I need to work
around that.
Attila.
On 2008.05.02., at 21:08, Attila Szegedi wrote:
> 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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/