Hi!

> I think that accessors should be allowed with interfaces because an
> interface really is a specification on how to communicate and while
> accessors do pass messages, properties do not.

"Communicate" is a loaded term. Property access is communication too,
but properties aren't defined in the interfaces. In any case, if you're
allowing accessors in interface, you should bring back automatic
implementation of accessors, since if you're saying "you must provide
property $a" I should be able to say "OK, here's property $a, working
exactly as plain old PHP property". Either that or I'd have to write a
boilerplate code (and make a couple of errors on the way such as
breaking references and isset, which 99% of less-experienced PHP
programmers would do).
I think accessors in interfaces are a huge can of worms because of their
potential of mixing function calls and property access, while the latter
is traditionally not the domain of the interface. We should carefully
consider if we really have use case for it. Especially given that PHP
always has underlying default property access functionality that is
always available - unlike methods which if not defined lead to fatal
error. So while if you do $foo->bar() on wrong $foo it will break, if
you do $foo->bar on wrong $foo yu just get default behavior. Given that,
do we really need an interface there?
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

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

Reply via email to