Hi,

>From the discussions I feel that I can summarise like this:

1.  InsertionListeners can be helpful in certain cases, like when you need
to escape values and would seldom encounter exceptions.  Like XML for
example and maybe some cases in HTML (for example to replace multiple spaces
with multiple #nbsp; ).  I can't think of others just now....

2.  There are concerns about speed and complexity of Velocity.  I'm not sure
what the impact would be - maybe an implementation would help to point out
problems.  Is there a standard suite for testing speed?  I'd like to do a
before/after test...

3.  Where to add the functionality.  I was (and still am) in favour of
adding a single InsertionListener to the Context.  I feel that this would
allow for the best flexibility in the sense that you can add/remove the
Listener from the Context (which you already have).  You can even render the
same template escaped or unescaped depending on the Context.

4.  Chaining InsertionListeners.  I think Chaining can negatively affect
performance.  If someone really need a chaining mechanism he can add a
single Listener and build a chaining in his Listener implementation.

[VOTE]  Implement the an InsertionListener as mentioned above.  i.e. a
single Listener added to the Context.  A final performance test will
determine whether the code makes it's way into Velocity.
+1

~ Leon

p.s.  Thanx for thrashing this out with me - I sure learnt a bunch the past
couple of days.

----- Original Message -----
From: "Geir Magnusson Jr." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 06, 2001 1:14 AM
Subject: Re: [PROPOSAL] InsertionListener


> Jose Alberto Fernandez wrote:
> >
> > > From: Geir Magnusson Jr. [mailto:[EMAIL PROTECTED]]
> > >
> > >
> > > Leon Messerschmidt [mailto:[EMAIL PROTECTED]]
> > >
> > > > For what it is worth - I like this approach best.  It gives
> > > > you the power to
> > > > escape everything that you would like to do, but in the
> > > > exceptional cases
> > > > you are still able to switch the escaping of in a template.
> > >
> > > Since you now have to sprinkle Velocimacros around every
> > > single use of the
> > > technique you want to use :
> > >
> > >  #macro(ident, $value)$xml.turnOff(true)$value$xml.turnOff(false)#end
> > >
> > > Why not just do the escaping in the Velocimacro itself?  Or use a
> > > context-based tool directly?
> > >
> >
> > Did I mentioned the 95%-5% rule before. I think the whole point of the
> > argument requesting a listener is that it is useful in cases where you
need
> > to performe replacements more times than not.
>
> I don't remember the 95/5 rule.  And I don't think anyone has made the
> case that you would have more times than not :)
>
> > Using escaping in the velocimacro is fine, when you need few things
escaped,
> > but it becomes very error prone when you, or actually a non XML expert,
> > needs to call escape on almost everything.
>
> Ya.
>
> > Just to make clear we are all in the same page, in my example, you only
need
> > to use #ident($blah) in those rare cases in which you do not want
escaping.
> >
> > True, you still need to call something sometimes, but we are back in
balance
> > in the sense of only requiring action for the exception and not the
rule.
>
> If that's really the case, I agree.
>
>
> --
> Geir Magnusson Jr.                               [EMAIL PROTECTED]
> Developing for the web?  See http://jakarta.apache.org/velocity/

Reply via email to