Re: [RFC] Propety Accessors v1.1
| From: | Bernhard Schussek | Date: | Fri, 12 Oct 2012 08:36:53 +0000 |
| Subject: | Re: [RFC] Propety Accessors v1.1 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-63365@lists.php.net to get a copy of this message | ||
Hi Amaury,
2012/10/12 Amaury Bouchard <amaury@amaury.net>:
> As I said, both syntaxes can work together. For example:
> public:protected $a {
> get() { return ($this->_prefix . $this->_a); }
> set($val) { $this->_a = substr($val, 1); }
> }
A shortcoming of this syntax is that it does not offer a solution for
the isset() and usset() accessors. Different visibility syntaxes for
get/set and isset/unset would be unlogical and confusing.
Also, public:protected implies an order which does not have to be kept
in the block AFAIK. What is public and what is protected?
public:protected $a { // ???
protected isset() { ... }
private unset() { ... }
get() { ... }
set($value) { ... }
}
Bernhard