Re: T_AS in closures

From: Date: Wed, 05 Mar 2014 22:09:36 +0000
Subject: Re: T_AS in closures
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-72950@lists.php.net to get a copy of this message
From what I read (and that's all of it), people on the list were against (expression) as $foo and wanted more usage examples in the RFC. The overall reception seems positive to me. :) The author withdrew it because they wanted to add more stuff to the patch and then (apparently) never proposed it again. Actually, that discussion also mentions use (...) with regular functions, which would also be nice, but probably better left for another thread. On Wed, Mar 5, 2014 at 11:38 PM, Nikita Popov <nikita.ppv@gmail.com> wrote: > On Wed, Mar 5, 2014 at 10:28 PM, Andrey Andreev <narf@devilix.net> wrote: >> >> Hi, >> >> I was clicking on bugs.php.net/random today and I came across #54888, >> which is a feature request for the following syntax: >> >> $foo = 'whatever'; >> $bar = function() use ($foo as $baz) { /* use $baz here */ }; >> >> https://bugs.php.net/bug.php?id=54888 >> >> I don't know if other languages have it, but it seems nice and >> considering how much developers prefer foreach() over other loops >> because it allows them to "rename" the variable, I'm sure people would >> love it. >> >> Has this been discussed before? What are your opinions on it? >> >> Regards, >> Andrey Andreev. > > > There has been an RFC for this: https://wiki.php.net/rfc/useas > > IIRC the RFC was withdrawn because the reception was not very positive. You > might want to have a look at the discussion, see > http://markmail.org/message/q53myujswaesca2u and > http://markmail.org/message/nrptrylgkarqrpxk. > > Nikita

« previous php.internals (#72950) next »