Re: weird macro params issue
Attila Szegedi <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Just a quick heads up that I'm making some progress with this in the 2.4 codebase. There are four cases arising from the four possible combinations of (positional,named) x (positional,named) in declared parameter list and invocation parameter list; I've written the code for 2 of them so far. An immediate additional benefit is that defaults will also be processed for TemplateMethodModels, TemplateDirectiveModels and TemplateTransformModels that declare them in their @Parameters annotation, something that as far as I can see wasn't supported previously at all. Attila. On 2008.05.23., at 14:16, Daniel Dekany wrote: > Friday, May 23, 2008, 2:12:11 PM, Daniel Dekany wrote: > >> Friday, May 23, 2008, 1:51:13 PM, Denis wrote: >> >>> Resend >> >> (Like this? Get a decent mail client... :) Oh, sh*t, I have just >> realized you have an iPhone! Please, don't hit me! :-> ) >> >>>>>> Some people will protest, that are used to defaults as mere >>>>>> constant >>>>>> values, >>>>> >>>>> Puzzling opinion... why would anyone *protest* about it? Yeah, I >>>>> can >>>>> see as someone finds <#macro chapter title linkLabel=title> and >>>>> "WHAT??? This Is Outrageous!!! Defaults were always constants! >>>>> This >>>>> is >>>>> how our fathers did it, and the fathers of our fathers!". ;) >>>> >>>> Lol >>>> They will protest because in Python and others, the other arguments >>>> are not in the current scope. Similarly when you do >>>> >>>> VAR x = x >>>> >>>> It uses x in the enclosing scope, it is not a recursive definition. >> >> That stands for default argument thing of FTL as well. You can say >> <#macro foo x=x> after all. The scope of the default value expression >> is the whole parameter list. >> >>>> Btw how does the multipass deal with >>>> >>>> <#macro foo=bar bar=foo> >>>> ? >> [snip] >> >> It fails with error. (Even if you don't forget the macro name... ;) ) > > Or not. See Attila's answer... > > -- > Best regards, > Daniel Dekany ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php