Re: [RFC] [Discussion] Short Closures

From: Date: Mon, 31 Aug 2015 21:05:35 +0000
Subject: Re: [RFC] [Discussion] Short Closures
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-87961@lists.php.net to get a copy of this message
Hi! > I had this RFC in draft since some time, but delayed it due to all > the ongoing PHP 7 discussions. Also we have no master branch to merge > features in until 5.4 EOL. Thus I'm reviving this now. > > Time for the first RFC targeting PHP 7.1 (assuming PHP 8 isn't going > to be the next version ;-)): > > The short Closures RFC: https://wiki.php.net/rfc/short_closures I personally don't see much advantage in making PHP code less readable and harder to parse. Also, "automatically use () all of the (compiled) variables" does not look like a good idea - first, users have no idea what compiled variables are, so the result would be unpredictable for them, second, if there are a lot of variables in the scope (like global scope) it would have huge performance costs for no gain. Also, this syntax does not allow "use by-ref" which the existing syntax does allow. I think we already have syntax for anonymous functions and it works. The only addition in this RFC is automatically gobbling up all local variables, which in vast majority of use cases is not what the function needs. -- Stas Malyshev smalyshev@gmail.com

« previous php.internals (#87961) next »