pelmered's avatar

Peter Elmered

pelmered

Member since

30

Total Reputation

1

Total Arguments

4

Total Votes for Arguments

Arguments and votes

1

I think static constructors creates a nicer API, but if it is between this and nothing I'm leaning yes.

I would rather write MyClass::new()->doSomething() than new MyClass->doSomething() in most cases. Therefore I would have liked all PHP classes to have a static constructor as well. This constructor could of course be overwritten if you want so it would not break any existing code. These two options are also not mutually exclusive, so I would be happy if they could co-exist.

Share:
Read the RFC: new MyClass()->method() without parentheses pelmered avatar
pelmered
voted yes
4

Its a nice concept but the proposed implementation will make defining visibility very complicated. Right now there are 3 visibility options, and its easy to understand what you can and cannot do when working with inheritance. Trying to understand the visibility hierarchy with this new RFC will take some time. https://wiki.php.net/rfc/asymmetric-visibility-v2#inheritance

Share:
Read the RFC: Asymmetric Visibility v2 ali avatar
ali
voted no
12

This really makes the language complex.
The part with the interactions with the readonly keyword is really hard to make sense of.

I understand the subtle differences, don't get me wrong, it's just that I cannot understand them by just looking at the property definitions quickly. Imagine having to quickly make sense of a class with a dozen of properties like that. It's just nightmarish. I wouldn't accept a merge request that messy in my codebase.

I feel like if you need that much fine-grain control this is when having explicit getters/setters make sense.

Add property hooks on top of that and you have an explosion of complexity where you don't want: your domain logic is complex enough on it's own, you don't want to have properties become a maze.

Share:
Read the RFC: Asymmetric Visibility v2 nreynis avatar
nreynis
voted no
9

It certainly is a fancy feature, but it takes too much a toll on the cognitive load.

Right now visibility is straight-forward. In a glance I can map in my head the possible operations on a property when I see its visibility. Adding this to the language will mean there will be moments that I'll have to stop and work out exactly what it means I can do with a property.

Also, property hooks already solve these use cases: defining a virtual property hook with only a getter will prevent you from setting the property, and vice versa.

Share:
Read the RFC: Asymmetric Visibility v2 yogarine avatar
yogarine
voted no
RSS Feed Contribute Watch on YouTube Our License
© 2024 RFC Vote. This project is open source. Contribute and collaborate with us!