Short Closures 2.0

Read the RFC
101
373 yes
66 no

This RFC proposes a way to have multi-line short closures — closures that don't need explicit use statements, but can still have multiple lines and a return statement.

Click the bar to cast your vote!
85%
15%
1

I like the idea of auto-capture!

Share:
oleg-andreyev avatar
oleg-andreyev
voted yes
1

Makes them more useful!

Share:
johnluxor avatar
johnluxor
voted yes
1

usable

Share:
brilliant-almazov avatar
brilliant-almazov
voted yes
1

Best of both worlds (auto-capture + ability to build return value using intermediate variables).

Share:
invisiblesmiley avatar
invisiblesmiley
voted yes
1

Callbacks are the bread-and-butter of any modern PHP developer, so being able to trim down the cruft to make code more consise and readable is a no-brain win.

Share:
liam avatar
liam
voted yes
1

When using utility functions that expect callable/Closure as parameters you are currently forced to bring over all required variables with the use statement. Depending on context that can be a lot of variables and any time the code changes you need to keep track of that list of variables.

Share:
ludwig-gramberg avatar
ludwig-gramberg
voted yes
1

Having used short closures for a while now they feel really good.

Share:
michael avatar
michael
voted yes
1

I think the proposition is not "must have" option but it's ok

Share:
yoshi129 avatar
yoshi129
voted yes
1

the biggest advantage for me is that you then need to use the use keyword when you need data from outside.

Share:
victor-falcon avatar
victor-falcon
voted yes
1

Just use "fn" everywhere my fingers hurt from typing "uction" all the time.

Share:
sidux avatar
sidux
voted yes
1

Multi lines short closures with arrow function? What we're missing!

Share:
mirchaemanuel avatar
mirchaemanuel
voted yes
1

It makes my code much clearly

Share:
indigoram89 avatar
indigoram89
voted yes
1

since we are moving in the c# direction, why not take a really good thing they do

Share:
ddruganov avatar
ddruganov
voted yes
1

That's a very good idea. More convenient than using use

Share:
bbldn05 avatar
bbldn05
voted yes
1

I don't see a reason for not implementing this. It would make writing closures much more easy and natural.

Share:
sebastiandittrich avatar
sebastiandittrich
voted yes

Check out another RFCs

Asymmetric Visibility v2

A new syntax for declaring the “set” operation visibility of an object property

21
21 yes
38 no
new MyClass()->method() without parentheses

Chain method on newly created objects without parentheses

54
95 yes
16 no
Interface Default Methods

Interface Default Methods improves backwards compatibility when changing interfaces, but also add a way to have multi-inheritance in PHP.

95
168 yes
264 no
RSS Feed Contribute Watch on YouTube Our License
© 2024 RFC Vote. This project is open source. Contribute and collaborate with us!