On Wed, 2008-05-14 at 14:37 +0200, Christian Schneider wrote:
> Richard Quadling wrote:
> > _IF_ the property was defined in an interface, should "unset" be
> > "allowed" to remove the property?
> 
> a) Interfaces do not define attributes, they define a set of methods.
> b) If the above would be changed I still want to be able to shoot myself
> in the foot if I *explicitely* say so.

I think in the case of an property declared in an interface, the
semantics should be tightened slightly. Rather than doing a complete
unset where the property is removed, instead the property would be
unlinked from any references (if such is the case) and assigned the
value null. This will still preserve the desired behaviour when checking
the property with isset() but the property will still exist so that the
interface requirement for the property to exist is still met.

The point about shooting yourself in the foot doesn't really apply here
since you can't shoot yourself in the foot by not declaring a method
when implementing an interface so why should you be allowed that option
for a property specified in an interface? Your alternative is as it
always is... don't use the interface or use one that lets you shoot
yourself in the foot.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to