Re: [RFC] [Discussion] Short Closures

From: Date: Tue, 01 Sep 2015 09:00:08 +0000
Subject: Re: [RFC] [Discussion] Short Closures
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-87984@lists.php.net to get a copy of this message
On Tue, Sep 1, 2015 at 10:44 AM, Anthony Ferrara <ircmaxell@gmail.com> wrote: >> 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? > > That's precisely what's happening. Not all variables are bound, only > those that are used. Somehow somewhere in this thread the confusion > was implied that the entire scope is copied. > Oh, nice - thanks for explaining that. :) >> 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. :) > > Typing on closures is outside the scope of this RFC. > > With that said, I'd love to hear and see examples of this. It's > something I definitely want to do, just haven't come up with a good > enough way to do it... > Yeah, I know it's outside of the scope of the RFC, it was more of a general question whether or not it would be possible in the future. Also, exactly what examples would you want to see? Pavel

« previous php.internals (#87984) next »