Re: [PHP-DEV] Re: TextIterator changes

[email protected] (Andrei Zmievski)
Newsgroups php.i18n,php.internals
Message-ID <[email protected]>
TextIterator does not implement Iterator interface, only Traversable. 
It just happens to have functions of the same name as Iterator.

-Andrei

On Jun 23, 2006, at 2:16 PM, Michael Wallner wrote:

> Andrei Zmievski wrote:
>> I am working on implementing BreakIterator API [1]. I considered two 
>> approaches: making a separate class or merging the API into the 
>> existing TextIterator. Having a separate class would be a bit 
>> cleaner, but I can see people wanting to use it in foreach(), and 
>> since TextIterator already provides a lot of BreakIterator's 
>> functionality, I decided that merging would be the best option. 
>> However, there is an overlap between the BreakIterator API and the 
>> current TextIterator one, so there will have to be some changes.
>> 1. TextIterator::current() signature will change from:
>>    mixed current()
>> to:
>>    mixed current(integer &$offset)
>
> This will raise the same issue as we have/had with the reflection API:
> mike@honeybadger:~/build/php-unicode-debug$ cli -r 'interface 
> i{function f();} class c implements i{function f($a){}}'
>
> Fatal error: Declaration of c::f() must be compatible with that of 
> i::f() in Command line code on line 1
>
>
> Nah, don't look at me--I don't like that either.
>
>
>> 3. TextIterator::rewind() will be renamed to TextIterator::first() to 
>> conform to BreakIterator's first()/last() API.
>> So this is heads up. Let me know if you have a problem with this.
>
> Huh? Rename or alias? It can't implement Iterator if there's no 
> rewind() method.
>
> Regards,
> -- 
> Michael
>
> -- 
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.