Re: [PHP-DEV] RFC: Support for multi-line arrow functions

2020-10-05 Thread Andreas Leathley
On 04.10.20 22:08, Rowan Tommins wrote: If we added an opt-in syntax for "capture everything", we might instead write this: $f = function() use (*) { $x = $y = $z = null; } Without re-initialising all local variables, we would no longer be able to know if they were actually local without l

Re: [PHP-DEV] RFC: Support for multi-line arrow functions

2020-10-05 Thread Michael Voříšek - ČVUT FEL
Yes, "use (*)" is perfect! With kind regards / Mit freundlichen Grüßen / S přátelským pozdravem, Michael Voříšek On 5 Oct 2020 11:57, Andreas Leathley wrote: On 04.10.20 22:08, Rowan Tommins wrote: If we added an opt-in syntax for "capture everything", we might instead write this: $f = fun

Re: [PHP-DEV] RFC: Support for multi-line arrow functions

2020-10-05 Thread Lynn
On Mon, Oct 5, 2020 at 12:00 PM Michael Voříšek - ČVUT FEL < voris...@fel.cvut.cz> wrote: > Yes, "use (*)" is perfect! > > With kind regards / Mit freundlichen Grüßen / S přátelským pozdravem, > > Michael Voříšek > > On 5 Oct 2020 11:57, Andreas Leathley wrote: > > > On 04.10.20 22:08, Rowan Tommi

Re: [PHP-DEV] RFC: Support for multi-line arrow functions

2020-10-05 Thread Deleu
To me that seems like a great argument in favour of the proposal. If you'll want all variables to be imported (which in this case makes completely sense), then `fn() {}` or `fn() => {}` is much less verbose and inline with the mentality to reach for short closures. We reach for short closures to av

Re: [PHP-DEV] RFC: Support for multi-line arrow functions

2020-10-05 Thread Andreas Leathley
On 05.10.20 12:08, Lynn wrote: How should php deal with the scenario where you want to `use` everything and have one variable by reference? ``` function () use (*, &$butNotThisOne) {}; ``` The easiest would be to only allow "use (*)" with no references or additional syntax. "use (*)" would onl

Re: [PHP-DEV] RFC: Support for multi-line arrow functions

2020-10-05 Thread Andreas Leathley
On 05.10.20 12:15, Deleu wrote: To me that seems like a great argument in favour of the proposal. If you'll want all variables to be imported (which in this case makes completely sense), then `fn() {}` or `fn() => {}` is much less verbose and inline with the mentality to reach for short closures.

Re: [PHP-DEV] RFC: Support for multi-line arrow functions

2020-10-05 Thread Markus Fischer
On 05.10.20 12:24, Andreas Leathley wrote: On 05.10.20 12:08, Lynn wrote: How should php deal with the scenario where you want to `use` everything and have one variable by reference? ``` function () use (*, &$butNotThisOne) {}; ``` The easiest would be to only allow "use (*)" with no referenc

Re: [PHP-DEV] List of attributes

2020-10-05 Thread Nicolas Grekas
> > Hi Benjamin, hi everyone I'm wondering if the syntax that allows for several attributes is really future-proof when considering nested attributes: *1.* #[foo] #[bar] VS *2.* #[foo, bar] Add nested attributes to the

[PHP-DEV] static vars must allow expressions

2020-10-05 Thread David Rodrigues
Hello! I would like to suggest that static vars must allow expressions too. Currently it only supports scalar values, but different to consts, it could be manipulated by its own function that uses that. https://www.php.net/manual/en/language.variables.scope.php#language.variables.scope.static Cu

Re: [PHP-DEV] static vars must allow expressions

2020-10-05 Thread tyson andre
Hi David, > I would like to suggest that static vars must allow expressions too. > Currently it only supports scalar values, but different to consts, it could > be manipulated by its own function that uses that. This idea was brought up 6 months ago with others in https://wiki.php.net/rfc/calls_