Re: Class Properties in Interfaces?
| From: | Christian Schneider | Date: | Mon, 19 May 2008 13:23:09 +0000 |
| Subject: | Re: Class Properties in Interfaces? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-37720@lists.php.net to get a copy of this message | ||
Richard Quadling wrote:
> In trying to understand the proposal of allowing properties via
> interfaces from your (Chris') point of view, what benefit do we get?
I don't use interfaces at all so I don't have a strong opinion about the
benefits or drawbacks of adding properties really but ...
> Allowing unset on properties in the class or in the interface, then
> this seems like normal class properties.
> We are talking about extending the behaviour of interfaces. Surely
> this implies a greater amount of rigidity?
... nevertheless my opinion about two things:
a) If I decide to modify an object at runtime then that's my decision
and I supposedly know what I'm doing.
b) The object will still work with the interface as accessing an unset()
property is not different from accessing a property set to null (save
the E_NOTICE if enabled): It returns null. It therefore does not make
sense to change anything IMHO.
I have yet to be shown a code example where we would get any benefit
from restricting things.
- Chris