Hello Andi, Friday, November 19, 2004, 12:09:12 AM, you wrote:
> At 08:55 AM 11/17/2004 +0100, Marcus Boerger wrote: >>Hello Andi, >> >>Tuesday, November 16, 2004, 11:56:48 PM, you wrote: >> >> > Marcus, >> >> > I didn't see discussion about this. How much is such a countable interface >> > really needed? Is this only for SPL or is this supposed to be general >> > purpose. I would prefer to only see it in SPL but I see you made some >> > changes to array.c. This might lead to inconsistency with the rest of PHP >> > where this interface works in some situations and not others. >> >> > If you see this being similar to __get, __sleep and friends then maybe the >> > method which has to be implemented should be __count? >> >> > Anyway, what do you think? Can we keep this SPL only? >> > (I apologize for being so late on my emails but I'm catching up now). >> >>This change is somewhat SPL only - somewhat as surely you could use SPL >>crap for other things too. The reason i added this is that it does not >>make sense to add other functions and btw. We'd need to rewrite count() >>to support object visibility since this is one of the few places left >>that doesn't. (apart from that the whole countable idea based on user >>requests). > I didn't quite understand :) > It doesn't seem to be SPL only as you touched array.c. Can you please be a > bit more precise about how you expect people to use/not to use this feature? You simply implement the interface countable and then your objects can be put into count() to get the count function called. This is very helpful with ArrayObject/ArrayIterator which are array wrappers and thus they should work in count() as expected. Best regards, Marcus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php