Paulo Gaspar wrote:
> 
> I still like it. It solves big problems like mine -> loads of data. It can
> save a lot of resources.

There still may be a solution that you as a talented Java programmer
could employ w/o doing something that I  am *sure* will bewilder and
confuse people.
 
Or not.  Understand that I understand your issue.

> Look:
>  1 - The programmer implementing the Iterator and placing it in the Context,
>      MUST know what an Iterator is.

I am not 100% sure of that. :)

>      And he can implement a reset method
>      usable in the template anyway - it will still be an Iterator
>      implementation. What you point out is an Application issue, not a
>      library one;
>      =:o)


The point is not that there is some taboo about the iterator itself -
the question is how can we avoid the problem noted, that if it's an
Iterator placed into the context, someone is going to run aground.

<self-loathing>
Would it be worth it to consider defining an interface like

public interface VelIterator extends Iterator
{
        public boolean reset();
}

so you can wrap your Iterator, but then there are no surprises re
reset()?  Foreach or any other looping contruct that may come down the
pike will call it after use, and if you are doing something 'special',
like working with a foward only RS, then so be it.  You are at least
consciously making reset() do nothing...

</self-loathing>



>  2 - It is _major_ pain to implement a Map or a Collection, but so easy to
>      implement an Iterator;
>  3 - Some Iterators (like over some performant forward only ResultSets)
>      naturally can not be reset. They are still damn useful.

Right - I understand that the clueful of the world won't have a
problem.  I am worried about those that don't realize the problems they
will run into.  I am generally not a hand-holder, but we are trying to
make a simple, clean tool targeted towards simplicity for the designer,
a different skill set than the programmer.  Yes, a programmer has to be
involved, but I am wondering how long it will be before someone puts
together a scriptable servlet where a designer can toss premade beans
into the context via external script/xml, etc, etc, etc...

We can certainly support it.  I would almost be rude not to.  Maybe the
way to go is to holler and scream into the log when we run across a
naked Iterator....

> Maybe I really need plugable introspection.

You certainly need something...

> =:o)
> 
> Have fun,
> Paulo

Always do.

geir

-- 
Geir Magnusson Jr.                               [EMAIL PROTECTED]
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity

Reply via email to