geoffreyvanwyk's avatar

Geoffrey van Wyk

geoffreyvanwyk

Member since

90

Total Reputation

4

Total Arguments

10

Total Votes for Arguments

Arguments and votes

1

With this feature, one can conveniently set a property directly, but still have validation on it behind the scenes. This is more convenient than using __set.

Share:
Read the RFC: Property Hooks geoffreyvanwyk avatar
geoffreyvanwyk
voted yes
1

This makes things easier.

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

It is awesome.

Share:
Read the RFC: The Pipe Operator geoffreyvanwyk avatar
geoffreyvanwyk
voted yes
1

Let us rather remove the writeonce behavior from readonly and add a separate writeonce keyword.

The private(set) syntax is also ugly.

Share:
Read the RFC: Asymmetric Visibility v2 geoffreyvanwyk avatar
geoffreyvanwyk
voted no
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
7

I think this would be a great improvement.

I prefer this:

$result = "Hello World"
    |> htmlentities(...)
    |> str_split(...)
    |> fn($x) => array_map(strtoupper(...), $x)
    |> fn($x) => array_filter($x, fn($v) => $v != 'O');

instead of this:

$result = "Hello World"
    |> 'htmlentities'
    |> 'str_split'
    |> fn($x) => array_map('strtoupper', $x)
    |> fn($x) => array_filter($x, fn($v) => $v != 'O');
Share:
Read the RFC: The Pipe Operator william-2 avatar
william-2
voted yes
88

With First-class callable syntax available since 8.1, it would now be possible to write it as below, which is much better then string names of functions:

$result = "Hello World"
    |> htmlentities(...)
    |> str_split(...)
    |> fn($x) => array_map(strtoupper(...), $x)
    |> fn($x) => array_filter($x, fn($v) => $v != 'O');
Share:
Read the RFC: The Pipe Operator pronskiy avatar
pronskiy
voted yes
65

For me, the most important argument is that the pipeline pattern is a tried and tested pattern, that this RFC builds upon. A couple of examples:

This RFC adds syntax to make using these kinds of pattern much more convenient.

On top of that, there's the argument that multiple modern languages support a pipe operator:

Finally, I've had numerous occasions where a pipe operator would simplify my own code — I have more than a handful real life cases where this would be useful.

Share:
Read the RFC: The Pipe Operator Contributor brent avatar
brent
voted yes
RSS Feed Contribute Watch on YouTube Our License
© 2024 RFC Vote. This project is open source. Contribute and collaborate with us!