> Like I said before, the factory and singleton patterns are just example
> applications of this mechanism.
Right, but I'd like to see why we *need* it - i.e. what it allows to do
that other things don't. I'm afraid that we might have a case of
featuritis here (not meaning this specific proposal, I'm talking more in
general state of affairs) in 5.3 - we will turn PHP from simple language
into minefield of magic methods where you can't possibly know what the
code you are looking at actually does. It might be useful for some
applications but might hurt the language as a whole. It also can have a
lot of implications what have unintended - i.e. how typehints are
supposed to work with this? How reflection and autoloading would work?
What with static methods and variables?
> What I want to use them for in PHPUnit is improving the Mock Objects
> system.
As far as I know, Java has unit tests but doesn't allow replacing
classes. How does it work in Java?
> I hope this makes my motivation for the feature more clear.
Yes, I can see the motivation now, but I'm not entirely convinced
allowing to replace classes with other classes would be the best
solution. I know there are OO languages extensively using unit testing
and not having this feature - I'd propose looking into how it is done there.
--
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com