Marcus Boerger wrote:

> As a side note: There is no generally understood hasMore(). 

I strongly disagree - the Java Iterator has a hasNext() method which is the
exact sementic of hasMore().

> Though there
> is isDone() and hasMore() is sometimes used/implemented as !isDone(). The
> main problem is that the original Iterator description everyone refers to
> doesn't have isValid() but instead only has isDone() which doesn't fit
> into for(;;). Reference: Gamma et Al, Design Patterns, 1994, Addison
> Wesley, p 257ff

Hehe - I happen to have the book open on that page:)

Fortunately, PHP does not implement GOF patterns wholesale, therefore
procedural PHP constructs such as foreach need to deviate from the
isDone(). It logically requires an isValid() expression - not a hasMore()
or hasNext().

The isValid() iterator method is implemented in the Eclipse project - it
gets a mention in dispatches on phppatterns: http://www.phppatterns.com
index.php/article/articleview/50/1/1/  (just over half way down).

Regards

Philip

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to