Re: RFC: C-sharp style property get/set syntax for PHP
| From: | president at basnetworks dot net | Date: | Thu, 02 Dec 2010 13:59:13 +0000 |
| Subject: | Re: RFC: C-sharp style property get/set syntax for PHP | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-50813@lists.php.net to get a copy of this message | ||
>> Why change the expected behavior of isset? If a property has not been
>> set
>> then isset must return false, and that includes $foo->name = NULL.
>>
>>
>> Regards.
>>
>
> Say the property is write-only. How can isset() operate on that? If
> the property is read-only, how can you unset() it?
If the property is write-only, I would imagine isset would return false,
because there is no value to read. I think when you call isset(), you are
asking, "is there something for me to read?", so this would make sense.
If the property is read-only, then unset would have no effect. Unsetting
is a "write" action (like deleting a file), so if its read-only, it cannot
be unset. It could possibly throw a non-fatal error too I suppose.
- Dennis