Keith Devens .com |
Saturday, July 4, 2009 | ![]() |
| Men never do evil so completely and cheerfully as when they do it from religious conviction. – Blaise Pascal (attributed) | ||
|
| ← Testing a Formation change | NewsForge | Linux needs better network file systems → |

Harry Fuecks (http://www.phppatterns.com) wrote:
Keith Gaughan (http://talideon.com/) wrote:
OTOH, classes just suck anyway. Prototypes Abú!
83.30.198.249 wrote:
Looks like I am not alone in thinking that the newer php version we have the more limits we have: http://blog.gosu.pl/comments.php?id_news=7
Joe Cheng (http://www.joecheng.com) wrote:
Can't you use PHP 5 delegates to fake mixins?
http://www.zend.com/zend/php5/php5-delegation.php
It all comes down to message passing, after all...
Keith (http://keithdevens.com/) wrote:
Thanks for the link, Joe.
This doesn't do exactly what I want, but it's close. Unfortunately, it doesn't work under both PHP 4 and 5, so I have to program it the brain-dead way anyway if I want it to work under both. Though maybe I could do something to use object aggregation under PHP 4 and delegation under PHP 5.
However, it still enforces an artificial separation between the two since I can't do things like access the first class' instance variables from the delegated class through $this, but that's not such a big deal. Though, this is all probably much less efficient than the PHP 4 object aggregation feature since it involves temporary objects and lots of indirection.
Oh yeah, and I'm a huge fan of prototype-based object systems.
Feel free to post a comment below. Please see my comment policy.
Formatting Rules (No HTML):
Generated in about 0.233s.
(Used 8 db queries)
To an extent there's an alternative in Class kit: http://pecl.php.net/package/classkit - not quite the same but almost - of course you've got to compile it yourself. You might also get some mileage out of the _get(), set() and _call() "magic" methods
But agree - think object aggregation was a useful tool that should be restored. There's other buzz words it would make possible like AOP and Metaclasses.
The PHP 4.3.x implementation was good, IMO, as it encouraged use only for exceptional situations, rather than as an alterative to the current inheritance mechanism. So no ones going to go wild with multiple inheritance, which seems to be the "fear" that had it removed.
Some other people with thoughts in the same area;
http://jaxn.phpenterprise.net/blog/archi...Programming-is-Important-for-PHP.html
http://jaxn.phpenterprise.net/blog/archives/419-More-on-Aspect-Oriented-PHP.html
http://www.futuraworkz.com/index.php?p=8