florentpoujol's avatar

Florent POUJOL

florentpoujol

Member since

35

Total Reputation

1

Total Arguments

5

Total Votes for Arguments

Arguments and votes

1

The point of short closure is to be one instruction only, plus you can already have the body of a short closure on multiple lines.

Regular closure can do multiple lines and instruction already.

To me this is a tiny syntactic sugar that is really unecessary.

Share:
Read the RFC: Short Closures 2.0 florentpoujol avatar
florentpoujol
voted no
10

Thanks to readonly properties, I started relying more and more on properties alone. However, I actually often find the need for more fine-grained control over input and output, but adding methods feels so heavy-weight. Property hooks feels like the perfect solution for some of my use cases.

Share:
Read the RFC: Property Hooks Contributor brent avatar
brent
voted yes
17

In combination with Asymmetric visibility this will allow to replace all getters and setters with trivial properties and occasional hooks.

Share:
Read the RFC: Property Hooks pronskiy avatar
pronskiy
voted yes
4

Short closures were meant to be that - short. If you need multiple lines, just create a function (it can even be a closure). Or just use a standard anonymous function instead of a short closure. It will also create confusion with having access to variables outside the short closure scope while letting it look like a normal function.

Share:
Read the RFC: Short Closures 2.0 jim avatar
jim
voted no
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
RSS Feed Contribute Watch on YouTube Our License
© 2024 RFC Vote. This project is open source. Contribute and collaborate with us!