At 12:44 02/08/2006, Lukas Smith wrote:
Derick Rethans wrote:
On Wed, 2 Aug 2006, Lukas Smith wrote:
again i feel that people who want to use PHP as a "proper" OO language will
definately benefit from a strict mode if they are willing to put
in the extra
planning. however alienating the userbase for this by making it
impossible to
keep the old low planning OO style would be a bad idea.
So then the only option is to introduce a
"i-dont-want-to-care-about-oo-in-my-classes-mode" for the people
who simply don't care.
yes .. it should be possible to set this on a per class basis. and
children should be able to change the mode. classes in lax mode
might also return false unless the classes match exactly.
I actually think this can be on a per method basis, so that methods
where it's strictly required (such as certain magic method as Marcus
said) will be able to set it, without affecting the entire
class. It's at the method level that the developer knows whether
overriding methods must adhere to the same signature.
My recommendation:
- Add a new flag to methods (at the implementation level) that will
allow to flag them as 'strict'
- In case such a strict method is improperly overridden - error out (E_ERROR)
- In case a non-strict method is improperly overridden - emit E_STRICT
- Consider adding userland ability to set entire classes or methods as strict
Most people who use 'strict OO' will have E_STRICT enabled and have
their code E_STRICT clean, so providing userland support for tagging
classes/methods as strict is probably not really necessary.
Zeev
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php