Re: Property Accessors v1.2 : Interfaces
| From: | Amaury Bouchard | Date: | Tue, 16 Oct 2012 07:39:30 +0000 |
| Subject: | Re: Property Accessors v1.2 : Interfaces | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-63431@lists.php.net to get a copy of this message | ||
2012/10/15 Clint Priest <cpriest@zerocue.com>
> Also, your "should be valid" statement implies that you feel properties
> and accessors are the same and they are not, internally. When a class
> attempts to implement an interface a "function check" is done and since
> there is no __getXX() function defined it would fail to implementation
> check against an interface.
>
> I cannot stress enough that properties != accessors in any way except the
> syntax in which they are used ($o->xyz) or ($o->xyz = 1), that is their
> *only* similarity.
I disagree. That's why I said this is a matter of choice. A philosophical
choice.
I don't see properties and accessors like different things which are
accidentally written the same. Accessors are a layer upon properties. It's
a magical layer, trying to mimic accessors.
It's a bit like aspect-oriented programming: you can add layer but the core
is still the same (from a developper point of view, not from the PHP
interpreter point of view).
See another argument: My proposal for read/write accessibility definition.
When I suggested to allow this syntax: "public:private $abc;"
some people objected that it's the same than "public $abc { get; private
set; }"
So, if I understand what you said, for you it's deeply different and
comparing them is like comparing apples and oranges. I disagree. I still
think my syntax is better (and could be implemented with better
performance), but it's normal to compare them, because they (can) offer
pretty much the same functionnalities.