Hello Zeev, Andi and the rest interested,

here's a cummulative patch of the last couple of weeks work which does the
following things:

- interface registration at c-level

  At the moment there is no easy/appropriate way to register an interface.

- interfaces may change classes when they get implemented (at c-level)

  At c level interfaces are given the ability to change the class entry. Which
  can be used for thinks like iterators and casting.

- iterators are implemented by class overloading driven by interfaces using
  the above technique.

  Since any class should be able to become an iterator i prefer a concept
  where a class becomes an iterator by implementing an interface. The first
  solution is to provide a standard interface with the necessary abstract
  functions and call these in the corresponding opcodes. This is pretty much
  what spl does. Anyway this is too much overhead and not as fast as i could
  be and also not the way the engine handles other things. That's why i did a
  overload like concept with the difference that i bound the iterator hooks to
  the class entry instead of the handler table. To also provide the concept of
  standard functions (the spl way) i added function pointers too and provided
  a dedicated fast function call facility (this way i didn't have the need to
  store the complete function_call_info_cache struct).
  
- disallow ctor/dtor calling as normal methods.

  I guess the majority would dislike this purity though. However i don't
  really like the ability of calling ctors and dtors as normal functions
  because it makes absolutley no sense and will only lead to problems.

- fix zval destruction order at shutdown.

  By trying to ensure that a zval is no longer referenced before it gets
  destroyed this part for example allows to access globals in destructors.

- change cast handler at c-level to allow partial cast support for selective
  types.

  This way you could for example provide a specialized string casting and do
  a fallback for all other types. This approach is for example usedfull for
  the standard exceptions to provide a way to change what is displayd. That
  is helpful for some extensions where more information is available than the
  simple message/code solution available with the default exception.

- implement __tostring (maybe we want toString()) using the above.

  This doesn't need further explanation, does it?

I got a few early testers and also some feedback and expirience:

- The zval destuction part doesn't solve all problems - you still can shoot
  you in the knees but in the otherhand it solves the normal things.

- The iterators perform well and they'd fit at least in everything rob and me
  could think of.

Last but not least i converted the spl tests and included them in this patch:
http://marcus-boerger.de/php/ze2/ze2-iterators-20030828.diff.txt

Any thoughts ?

  

-- 
Best regards,
 Marcus                          mailto:[EMAIL PROTECTED]

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

Reply via email to