Thanks Marcus

Looking at the documentation, the comments and method name (for hasMore())
do not have the same meaning - the comment is saying 'does the current
element exist?' and the method name says 'are there any more elements?'.

This makes the api very ambiguous - hasMore() and isValid() have very
specific meaning in many languages wrt iterators.

Whilst I appreciate adding an isValid() method to the Iterator interface is
not trivial (and I am loath to suggest a change this close to PHP RC
phase), but it is surely better to have an un-ambiguous api on release -
especially after all the clamouring for an interface implementation :)

Regards

Philip

Marcus Boerger wrote:

> Hello Philip,
> 
> have a look at it's dokumentation: ext/spl/spl.php
> there you'll find that hasMore() needs to be checked before an access to
> key() or current() can be done. Hence it's meaning is somewhat like
> isValid().
> 
> regards
> marcus
> 

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

Reply via email to