Hi

On 5/29/24 21:53, Andreas Hennings wrote:
Is there a reason why we cannot just make it "public private string
$x" instead of "public private(set) string $x"?
We would define that the second visibility specifier is for write.

The current proposal with "public private(set)" is less ambiguous, and
it is immediately obvious that this is something new, and not just
somebody accidentally added two modifiers.
At the same time, it feels a bit alien and cluttered.

Other options could be something like "public:private" or "public-private".

The variant with the parentheses is the most future-proof one, should additional operations be added. It would allow for:

    public private(set,unset,frobnicate) string $foo;

Even if tools would not yet understand whatever 'frobnicate' does, they would know that this is an operation that may be performed on $foo and would be able to syntax highlight the visibility definition properly and they would also know how to autoformat it, without needing to add support for the new keyword.

Best regards
Tim Düsterhus

Reply via email to