I need some kind of engine hook to allow this kind of code in the COM
extension:

foreach ($container as $child) {
    echo $child->name;
}

The way this works in COM is like this:

foreach fetches the magic iterator property from $container.
The magic iterator is an instance of IEnumXXX, where XXX is
most likely Variant, but could be anything.

It then repeatedly calls $iterator->Next() to fetch the next item.

When done, it releases the $iterator.

I know Marcus implemented iterators for spl, but the concept
there is that the $container itself needs to implement spl interfaces.
The just doesn't fit with the way COM stuff works, and pollutes
the COM object with magic (some COM objects want to handle
method and property accesses by magic themselves).

Can we have a extra handler in the object handlers struct that
returns an object that implements an engine-supported iterator?

--Wez.

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

Reply via email to