Re: Class Properties in Interfaces?

From: Date: Wed, 30 Apr 2008 19:25:06 +0000
Subject: Re: Class Properties in Interfaces?
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-37386@lists.php.net to get a copy of this message
Hi!
With the substantial difference, that __get()/__set() does not work properly with inheritance, as the language can't verify the LSP.
Language never could verify the LSP. The developer should do it - the language has no idea of what pre/postconditions in your code are. Language can provide a tiny bit of LSP support - namely, method signatures, etc. - but that's it.
This means, Child behaves more strict than Mother and breaks the principle.
Well, don't write such code. :)
With advanced properties, the interpreter could at least verify that getting/setting properties is not stricter in subclasses.
How? For that you'd need the interpreter to actually understand what the code does. While I'd like to have such thing one day (provided it does not rebel and decide to kill all humans, of course ;) PHP interpreter is definitely not it. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#37386) next »