Re: [RFC] Asymmetric Visibility, with readonly
| From: | Larry Garfield | Date: | Fri, 25 Nov 2022 00:07:14 +0000 |
| Subject: | Re: [RFC] Asymmetric Visibility, with readonly | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119031@lists.php.net to get a copy of this message | ||
On Sun, Nov 20, 2022, at 7:20 AM, Dan Ackroyd wrote:
> Hi Larry,
>
> Regarding the syntax, up until now PHP has only supported the letters
> a-z and underscore in keywords.
>
> I realise this is an aesthetic thing, but "private(set)" looks like a
> function to me, and not a keyword. I saw the previous poll, and it
> didn't include options for either protected_set/private_set or
> protectedset/privateset.
>
> Was there a technical reason for excluding them as an option?
Not in particular. We originally proposed
private(set) because that's what Swift
uses. In the discussion people proposed several alternatives that I put into the poll, but
private_set wasn't one of them. Although several people said they were opposed to
parens in the keyword, the two options that had parens (private(set) and
pubilc(set: private)) were the leaders for all rounds. I was quite surprised at that,
personally; I expected private:set to do a lot better under the circumstances. But
that's not how the poll played out.
--Larry Garfield