From: Eric R. <eb...@tc...> - 2004-04-05 01:09:08
|
On Apr 4, 2004, at 8:58 PM, Endre St=F8lsvik wrote: > It=B4s getting clearer.. > > When I make a Macro, and shove this thing into the context as "Rock",=20= > when > I do $Rock, or $Rock.roll, what happens?? This is, I assume, the most > used way to use Macro? If you initially called Template.write(out, context), then the .write()=20= method is getting called in your $Rock Macro. And that method calls=20 it's .evaluate() method to get the value to write: public Object evaluate(Context c) { return "Rock"; } public void write(FastWriter fw, Context c) {=20 fw.write(this.evaluate(c).toString()); } That's how it works. If you call $Rock.roll, then you're simply asking for the "roll"=20 property of the Rock macro (which could be a field, a method, or a=20 generic .get() method)... whose .toString() value gets output to the=20 template. eric. > And btw: It was the "original author" of WM that suddenly changed the > behaviour to cache everything before output, based on -dubious- > assumptions that this will give better performance - which I don=B4=20 > believe > at all. I=B4d like to be able to choose whether I like "direct=20 > rendering", > or complete buffering, in the latter case, I could easily do that=20 > myself, > instead of the WM internals doing it. > > > --=20 > Mvh, > Endre St=F8lsvik M[+47 93054050] F[+47 51625182] > Developer @ CoreTrek AS - http://www.coretrek.com/ > CoreTrek corporate portal / EIP - http://www.corelets.com/ > |