Re: [RFC] Allow "use( $longname as $alias)" syntax for closures declaration
| From: | Laruence | Date: | Thu, 12 Apr 2012 16:06:30 +0000 |
| Subject: | Re: [RFC] Allow "use( $longname as $alias)" syntax for closures declaration | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-59792@lists.php.net to get a copy of this message | ||
On Fri, Apr 13, 2012 at 12:04 AM, Dmitri Snytkine
<dsnytkine@ultralogistics.com> wrote:
> I'm curious to know the benefits of this.
> Care to explain why or when this would be useful?
From what LawnGnome said:
" I think it's a nice bit of syntactic sugar, personally. It's not
something you'd ever _need_, but it's a neat way of getting your
variable names in order within the inner scope if your enclosing scope
is a bit messy. Plus, it's consistent with the X as Y syntax that's
already in foreach and traits, which is a bonus."
thanks
>
>
> Dmitri Snytkine
> Web Developer
> Ultra Logistics, Inc.
> Phone: (888) 220-4640 x 2097
> Fax: (888) 795-6642
> E-Mail: dsnytkine@ultralogistics.com
> Web: www.ultralogistics.com
>
> "A Top 100 Logistics I.T. Provider in 2011"
>
> -----Original Message-----
> From: laruence@gmail.com [mailto:laruence@gmail.com] On Behalf Of Laruence
> Sent: Thursday, April 12, 2012 11:38 AM
> To: PHP Internals
> Subject: [PHP-DEV] [RFC] Allow "use( $longname as $alias)" syntax for closures
> declaration
>
> Hi:
> I have made a RFC to allow user use T_AS in the closure declaration, like:
>
> function () use($long as $l, &$long as $r) {
> }
>
> here is the RFC: https://wiki.php.net/rfc/useas
>
> any ideas? thanks
>
> --
> Laruence Xinchen Hui
> http://www.laruence.com/
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
Laruence Xinchen Hui
http://www.laruence.com/