Re: Iterator Class/foreach Logic Flaw?
| From: | Marcus Boerger | Date: | Thu, 26 Feb 2004 21:23:16 +0000 |
| Subject: | Re: Iterator Class/foreach Logic Flaw? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-8189@lists.php.net to get a copy of this message | ||
Hello Philip,
Thursday, February 26, 2004, 10:05:09 PM, you wrote:
> Hi Marcus
> Yes, the current implementation of hasMore() has an identical semantic to
> isValid().
> The generally understood semantic of isValid() and hasMore() are quite
> different - hence the need for the rename.
As a side note: There is no generally understood 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
> Regards
> Philip
> Marcus Boerger wrote:
>> Hello Philip,
>>
>> just to make it clear. hasMore() would be the exact same then isValid()
>> only the name would change. The semantic is already what you refer to as
>> isValid.
>>
--
Best regards,
Marcus mailto:helly@php.net