gilbertrdzdev's avatar

Gilbert Rodríguez

gilbertrdzdev

Member since

35

Total Reputation

1

Total Arguments

5

Total Votes for Arguments

Arguments and votes

1

"Very good idea, but it would be nice to avoid using strings in the function calls."

Share:
Read the RFC: The Pipe Operator gilbertrdzdev avatar
gilbertrdzdev
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
10

Makes code more clean because it is shorter and the use keyword is not needed anymore.

Share:
Read the RFC: Short Closures 2.0 buismaarten avatar
buismaarten
voted yes
8

Just look at how other languages solve this. C# for example. Make short closures like that.

Share:
Read the RFC: Short Closures 2.0 ricardo avatar
ricardo
voted yes
121

At least once a week, I throw away an array_map because it ended up looking too bloated and go with a classic foreach instead. Short Closures 2.0 without the use(...) block would've solved this problem, just 2 votes...

Share:
Read the RFC: Short Closures 2.0 davi avatar
davi
voted yes
RSS Feed Contribute Watch on YouTube Our License
© 2024 RFC Vote. This project is open source. Contribute and collaborate with us!