Hi Geir, Sorry for the delay, answer inline:
> -----Original Message----- > From: Geir Magnusson Jr. [mailto:[EMAIL PROTECTED]] > Sent: Monday, February 18, 2002 12:10 AM > > > On 2/17/02 6:18 PM, "Paulo Gaspar" <[EMAIL PROTECTED]> wrote: > > > Thanks Geir, > > > > I noticed that thread but did not pay enough attention to > > understand it. > > > > I just HAD to fix my version or I would get bad output, but I > > understand that this could break somethink elsewhere. > > Musing over this issue a bit more in response to your note, we will have a > snag we need to deal with - > > Suppose that I wrap one context in another. > > VelocityContext vc = new VelocityContext( another ); > > And then use the new one in rendering a template. > > Then what do we do? The idea of chaining is to make the 'inner' ctx > protected. > > This can produce some interesting and spooky effects. > > To illustrate : with a #set(), it won't work : > > #set( $somethingInner = $somethingNull) > > Results in $somethingInner being unchanged because this would affect the > outermost context, which already may not have anything in it, so it > delegates to the inner. We have to continue to support that contract of > protection. > > geir Let me see if I understand, the wrapped context is never modified. But if we have an entry called $somethingInner that is an entry for both the wrapper and wrapped contexts and we set it to null in the template, the $somethingInner entry would disapear from the wrapper showing to the template the value of the one still existeing in the wrapped!!! Argh! The only way to deal with that would be to be sure that the wrapper Map would accept null value entries but that an entry with a null value would still be considered no-value. Interesting complication. Another alternative is a kind of hierarchical map I have that des not let you add a value if the value already exists in the wrapped Map(s). But there the bahavior becomes TOO different since you are then unable to "overwrite" an entry of the wrapped context. =:o/ Really interesting. Have fun, Paulo Gaspar -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
