Re: RFC: C-sharp style property get/set syntax for PHP
| From: | larry@garfieldtech.com | Date: | Wed, 01 Dec 2010 00:25:57 +0000 |
| Subject: | Re: RFC: C-sharp style property get/set syntax for PHP | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-50746@lists.php.net to get a copy of this message | ||
On 11/30/10 6:15 PM, president@basnetworks.net wrote:
True, but if part of the intent (as noted in a previous email) is to provide a mechanism that looks to the outside world like a class member, and therefore one can switch between the two without breaking an API, then isset/unset should have some sort of useful meaning. They do for __*() magic methods and for ArrayAccess (albeit named differently), so there should be some sort of meaningful definition here. Otherwise they are only half a drop-in/break-no-API replacement for a class member. --Larry GarfieldThis doesn't make sense. To call isset() on a property, would be to ask if the property itself exists. But once defined, a property always exists (think of methods, for example). (Sorry for sending again Stas, I forgot to reply all) - DennisI actually like that, though I think we should support the whole existing semantics, i.e. get/set/isset/unset. And probably keep the names, so we don't call the same thing both "read" and "get".public property Hours read getHours write setHours;