Re: [RFC] Readonly properties

From: Date: Tue, 08 Jun 2021 22:58:11 +0000
Subject: Re: [RFC] Readonly properties
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-114789@lists.php.net to get a copy of this message
> On Jun 8, 2021, at 5:18 AM, Nikita Popov <nikita.ppv@gmail.com> wrote: > > Well, I think we can get an approximation like this: > > > https://beta.grep.app/search?q=%7B%20get%3B%20private%20set%3B%20%7D&filter[lang][0]=C%23 > <https://beta.grep.app/search?q={%20get;%20private%20set;%20}&filter[lang][0]=C#> > { get; private set; } 74,281 results > > https://beta.grep.app/search?q=%7B%20get%3B%20%7D&filter[lang][0]=C%23 > <https://beta.grep.app/search?q={%20get;%20}&filter[lang][0]=C#> > { > get; } 156,304 results > > https://beta.grep.app/search?q=readonly&filter[lang][0]=C%23 > <https://beta.grep.app/search?q=readonly&filter[lang][0]=C#> > readonly > 409,585 results > > Note that the "{ get; }" part includes both readonly properties and > get-only abstract properties, so that one is an overestimate. Using > variants like \{\s+get;\s+private set;\s+\} doesn't change the results > materially. > > Unless my methodology is completely borked, the ratio of readonly to > asymmetric visibility seems to be something like 4:1 even as a conservative > estimate. When you two are speaking of "asymmetric visibility," are you speaking of this RFC[1], this one[2], one I am not mentioning, or one that does not exist yet? If you are referring to [1] there is more to asymmetric visibility than what C# would call "auto-implemented properties[3]." If we search for get { we find 266,859 occurrences and another 5765 for { set{. I assume readonly would not address either of these? https://beta.grep.app/search?current=2&q=get%5Cs%2A%5C%7B&regexp=true&filter[lang][0]=C%23 <https://beta.grep.app/search?current=2&q=get%5Cs%2A%5C%7B&regexp=true&filter%5Blang%5D%5B0%5D=C%23> https://beta.grep.app/search?q=%5C%7B%5Cs%2Aset%5Cs%2A%5C%7B&regexp=true&format=e&filter[lang][0]=C%23 <https://beta.grep.app/search?q=%5C%7B%5Cs%2Aset%5Cs%2A%5C%7B&regexp=true&format=e&filter%5Blang%5D%5B0%5D=C%23> -Mike [1] https://wiki.php.net/rfc/property_accessors <https://wiki.php.net/rfc/property_accessors> [2] https://wiki.php.net/rfc/property_write_visibility <https://wiki.php.net/rfc/property_write_visibility> [3] https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/auto-implemented-properties <https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/auto-implemented-properties> P.S. You also over-counted readonly by 44k. If you go with case-sensitive for "readonly" you only get 365k. Seems they like using "ReadOnly" as part of symbol names. https://beta.grep.app/search?q=readonly&case=true&filter[lang][0]=C%23 <https://beta.grep.app/search?q=readonly&case=true&filter%5Blang%5D%5B0%5D=C%23> P.P.S. I'm not taking a position pro- or con- the readonly RFC, just wanting to clarify the stats used by others to evaluate.

« previous php.internals (#114789) next »