Adrian Tarau wrote:
I would like to apologize,
Are you apologizing to me? It's not clear. I was the person whose
private note you posted to the list.
It was NOT my intention to start something like this. I do NOT publish private
messages on public mailing lists with the intention to make a person look bad,
So what gave you this genius idea, this time?
I'm just sensitive to disrespectful people.
I just felt I had to post something on the devel list. Actually this is my first bad experience in 7-8 years on a forum/mailing list. On public or private messages I always had a civilized dialog with different software developers, even if sometime the subject was a little bit "hot".
My apologies if when I published his rant,
Adrian, I'm starting to think that you're a pathological liar. Also,
that you aren't very bright, because it's stupid to lie about things
where there is a clear electronic paper trail that shows you're lying.
Right here, above, you're referring to my private message to you as a
"rant". I have pasted the full message below, in raw form. This is the
message that you are characterizing as a rant. It must be the message,
because it's the only private email I ever sent you.
I just reread it and to characterize this as a rant is just utterly
dishonest. I read it and I see somebody quite generously taking the time
to explain to you exactly how to do what you want to do. It could
perfectly well be helpful. The stuff you took issue with is just the
last little bit, where I say:
"Well, in general, once you want to do anything moderately complex with
velocimacros, the thing breaks because it's.... junk. :-)"
Even there, it's a technically accurate sentence. I mean, it's obviously
quite true that whenever you try to do anything moderately complex with
velocimacros, given the way they are implemented, it breaks. So it's
just the last three words "because it's junk". But I even add a smiley
there, so you can opt not to take it seriously. (Though, I grant, I was
not really joking. :-))
But, look, anybody can read the whole message, and you just see that it
is hardly some anti-velocity "rant". It's me giving Adrian what is
potentially quite useful information. It's me taking the time to write a
helpful note to someone who is a complete stranger.
And now, Adrian is characterizing this as me sending him some rant that
outraged his sensibilities. that in so many years as a developer, he
never had seen something so shockingly disrespectful, blah blah. But....
he's lying...
STOP LYING, ADRIAN.
------------------------------------
From - Fri Feb 29 21:00:26 2008
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00800000
X-Mozilla-Keys:
Message-ID: <[EMAIL PROTECTED]>
Date: Fri, 29 Feb 2008 21:00:13 +0100
From: Jonathan Revusky <[EMAIL PROTECTED]>
User-Agent: Thunderbird 2.0.0.12 (Macintosh/20080213)
MIME-Version: 1.0
To: [EMAIL PROTECTED]
Subject: Re: Call a velocity macro
References: <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
In-Reply-To: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
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
Jonathan Revusky
--
lead developer, FreeMarker project, http://freemarker.org/
>
> In case of a value outside the 'domain' you will get an exception "Macro
> not found ....".
>
> We could have even a directive which will simulate the switch default
> branch.
>
> #callWithDefault($macroToCall $defaultMacro ....) - of course the name
> should be shorter.
>
> Christopher Schultz wrote:
>> Adrian,
>>
>> Adrian Tarau wrote:
>>> I have the following problem : I would like to call a macro but the
>>> macro
>>> name must be a variable.
>>
>> This is more of a question for the user's list, not the dev list. In
>> the future, please post there.
>>
>>> Ex: instead of #renderLabel($component) to have #call("renderLabel"
>>> $component) - of course "renderLabel" can be any (existing) macro name.
>>
>> How many possibilities can you have for $component? Are they
>> unlimited, or constrained to maybe 5 possibilities? I'm wondering
>> because you could easily do it like a switch:
>>
>> #if('renderLabel' == $macroToCall)
>> #renderLabel($component)
>> #elseif('renderInput' == $macroToCall)
>> #renderInput($component)
>> #elseif(...)
>> ...
>> #end
>>
>> -chris
>>
it looked like a dishonest action on my side.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]