On 24.03.2021 17:19, Larry Garfield wrote:
> 1) The updated short-functions RFC: https://wiki.php.net/rfc/short-functions
> 2) A new RFC, code by Nuno, for auto-capturing multi-statement closures: 
> https://wiki.php.net/rfc/auto-capture-closure

I'm not sure just the keyword (`fn`) should indicate the change in
variables scope handling (auto-capturing). Note that in Javascript it is
a new syntax not just the keyword.

Looks like a counter-proposal could be this syntax:

$foo = function($a, $b) => {
    $val = $a * $b;
    return $val * c;
}

then whether it is `fn` or `function` keyword does not really matter.
Here it is `=>` that indicates the auto-capturing in the block on the
right side.

I don't know. Another approach might be something that makes mind to
think this is something different than a function. A completely new
keyword that makes the code block to auto-capture. E.g. `procedure` or
`macro`.

-- 
Aleksander Machniak
Kolab Groupware Developer        [https://kolab.org]
Roundcube Webmail Developer  [https://roundcube.net]
----------------------------------------------------
PGP: 19359DC1 # Blog: https://kolabian.wordpress.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to