Really ya'll take it somewhere else.
Matthijs Lambooy wrote:
PLS STOP THIS
Jonathan Revusky wrote:
Konstantin Priblouda wrote:
--- Adrian Tarau <[EMAIL PROTECTED]> wrote:
I agree, don't judge any online community based on
guys like Jonathan. Just ignore them...
funny thig is, it' s spillover from completely
different community ;)
What different community? What are you talking about? The origin of
this thread is Adrian responding to my private note on a public list,
this one. The poor boy thought it was so shocking that I said that
Velocity (and I was quite specific referring to its macro system) as
"junk" in a private note, it was so shocking that he just had to
reply to me in a lecturing tone *in public*!!!
And then this guy continually lies subsequently, that he had heatedly
written a response to me "automatically". If he'd done that, he would
have hit "reply-to" and would have answered in private. He then later
referred to my private email as a rant, he had never seen anything
like that in 8 years! THat was really a lie, I mean, what I wrote him
in private a technically focused note. I'm going to provide it again
so you see what kind of snivelling lying scum this guy is.
The text of my "rant" (according to Adrian) follows:
----------------------------------------------------------
Adrian Tarau wrote:
> I've always used #if to implement the 'switch' but I think, even
for 3-4
> conditions, the template will look cleaner.
>
> Instead of
>
> #if('renderLabel' == $macroToCall)
> #renderLabel($component)
> #elseif('renderInput' == $macroToCall)
> #renderInput($component)
> #elseif(...)
> ...
> #end
>
> we will have
>
> #call($macroToCall $component).
This kind of thing is trivial in FreeMarker. For example, suppose you
had:
<#assign macroHash = {'renderLabel' : labelMacro, 'renderInput' :
renderMacro, .... >
and then, supposing you have an action string, like suppose:
[#assign action = 'renderLabel']
then you could invoke the macro via:
<@macroHash[action] component />
The thing is that macros in FreeMarker are variables, and can be in
hashes or assigned to variables or whatever, and also the foo in
<@foo/> to invoke the macro can be any arbitrary expression.
So, for example, suppose the macro you want to invoke is in the
string macroName, you could invoke it via:
<@.vars[macroName] component/>
(.vars is a special built-in hash that contains the variables
available in the template and since macros are variables as well,
.vars[macroName] is the macro with the name macroName and it can be
invoked this way, or you could create a variable.
<#assign myMacro = .vars[macroName]>
and invoke it via:
<@myMacro component/>
Well, in general, once you want to do anything moderately complex
with velocimacros, the thing breaks because it's.... junk. :-)
Here is a blog entry I wrote regarding some of this sort of thing:
http://freemarker.blogspot.com/2007/12/velocity-of-freemarker-looking-at-5.html
----[ Konstantin Pribluda http://www.pribluda.de ]----------------
JTec quality components: http://www.pribluda.de/projects/
____________________________________________________________________________________
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.
Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]