In Foreach.getIterator(), I don't "get" several things:
  - Why not accepting an object of type Iterator?

  - Why checking sizes to return null has in
            if (((Collection) listObject).size() == 0)
                return null;    
    ???
    That seems to be one of the forces behind inconsistencies 
    like the already criticized case of casting to Collection
    (just to mentioned the INFO_ITERATOR type) of an object 
    that only had to provide an iterator() method in the 
    initial check. The code would work anyway with an empty 
    iterator and, for speed, it is more correct to make a 
    hasNext() check to the resulting iterator. (Anyway, for
    speed, such check would only be efficient if there are 
    many empty #foreach arguments in typical use.)

  - Why caching the Introspection information based in the 
    #foreach directive object as in
        IntrospectionCacheData icd = context.icacheGet( this ); 
    ???
    It makes more sense to cache what is the right iterator 
    based on the listObject class, since the class of the 
    listObject might change between uses of the same template,
    but the found iterator will always be the same for each
    listObject class.


I am putting my hands on this, but just want to check if I am
missing something.


Have fun... and say something,
Paulo Gaspar

Reply via email to