rihardsgrislis's avatar

Rihards Grīslis

rihardsgrislis

Member since

15

Total Reputation

1

Total Arguments

1

Total Votes for Arguments

Arguments and votes

1

Supporting the RFC aligns with the direction modern programming languages are taking. In my work with PHP, I've often found closures to become needlessly verbose, especially when multiple variables are involved. The requirement of the "use" statement can make the code bloated:

return Cache::remember('key', 60, function () use ($start, $end, $other) {
    // Logic here
    return $result;
});

Multi-line short closures would eliminate this redundancy, making the code more concise and readable. On a side note, while the "fn" keyword isn't the core issue, it further adds to the awkwardness. As PHP continues to evolve, it should prioritize developer experience, and this RFC pushes it in the right direction.

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