uchm4n's avatar

UchMan

uchm4n

Member since

30

Total Reputation

2

Total Arguments

2

Total Votes for Arguments

Arguments and votes

1

Every major languages had this long time ago. Why is this still the subject for discussion, I don't understand. I don't think it affects performance of the language.

Share:
Read the RFC: Short Closures 2.0 uchm4n avatar
uchm4n
voted yes
1

Imagine, having chainable functions like Laravel collections inside php

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

That would be so useful. Not to mention about pipeline pattern, which can be implemented with this, so easy. I do like First-class callable syntax.

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