Jordi Boggiano wrote on 28/10/2014 07:17:
How about this instead for readonly:
public $foobar {
get { return $this->bar * $this->foo; }; readonly
}
And if the flag isn't there, set is implicitly present.
That'd mean you also can keep "public readonly $foobar;" as a
shorthand for readonly properties without custom getter.
I think it could be problematic to have too many variants of the syntax,
as it leads to more inconsistencies that people have to understand, and
more complex code needed in third-party parsers (IDEs, alternative
implementations, etc).
Keeping the "readonly" attribute also keeps the ambiguity of what it
actually means: immutable, protected, private? Sticking to the existing
visibility modifiers makes it more explicit what's actually being set.
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php