Re: supporting the final keyword for properties
| From: | Lars Strojny | Date: | Tue, 28 May 2013 08:58:33 +0000 |
| Subject: | Re: supporting the final keyword for properties | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-67578@lists.php.net to get a copy of this message | ||
Hi Ferenc,
Am 28.05.2013 um 08:15 schrieb Ferenc Kovacs <tyra3l@gmail.com>:
[...]
>> I would like it to work the same way as it does in java(
>> Iê;Y
>> ‚œ`Tþ¾K�æKhttp://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.12.4)
>> eg. you can set the initial value either in the declaration or later on,
>> but after it is set, you can't change it, trying to do that would create a
>> recoverable fatal error (or throwing an exception which extends
>> RuntimeException).
>>
>> What do you think? Would this be viable? Is there any still-present reason
>> why we shouldn't support that?
[...]
> the accessors rfc got rejected, so I'm bringing this up again.
It’s a good idea in general but what about having it for variables as well? Could open interesting
possibilities for an optimizer.
final $foo = "str";
$foo = "bar"; // bails out
cu,
Lars