Re: [RFC] [Discussion] Short Closures

From: Date: Tue, 01 Sep 2015 08:32:39 +0000
Subject: Re: [RFC] [Discussion] Short Closures
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-87979@lists.php.net to get a copy of this message
On Mon, Aug 31, 2015 at 9:29 PM, Bob Weinand <bobwei9@hotmail.com> wrote: > 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 > > Hoping for constructive feedback, > Bob > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > Hi, as a purely userland developer, I would definitely appreciate the shorthand function for anonymous functions; having tons of stuff like "function ($x) { return $x * 2; }" makes the code less readable in the end. I'm not sure about the "auto using" of all variables though; wouldnt it be possible to statically check for the used variables and only import what's needed, for performance reasons? Also, how hard would it be to add type hints (only for parameters)? Sometimes they are needed to make the IDE know the variable type because it can't be guessed automatically. I know about your note in RFC,this is just a question to other internal members.Return type can be infered by IDEs from the simple expresion quite easily. PS: would "() ~> foo()" work? I think it should, but I couldn't find a mention about it in RFC. :) Regards Pavel Kouril

« previous php.internals (#87979) next »