Re: Arrow function expressions in PHP

From: Date: Thu, 01 Oct 2015 18:09:08 +0000
Subject: Re: Arrow function expressions in PHP
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.internals 
Request: Send a blank email to internals+get-88618@lists.php.net to get a copy of this message
On Thu, Oct 1, 2015 at 11:57 AM, Rowan Collins <rowan.collins@gmail.com> wrote: > Levi Morrison wrote on 01/10/2015 18:40: >>> >>> Or we can figure out some other such symbol. Worse casing no white space, >>> brain storming: >> >> Please, I already asked people to stop making suggestions for shorter >> syntax for use(). > > > I tried to move the discussion to whether or not auto-capturing variables is > a good idea, regardless of syntax, but the responses continue to be of the > form "but that particular example syntax looks a bit ugly". > > So I agree, let's not discuss the details of ANY syntax, until we've come to > some conclusion on whether or not auto-capture is a negotiable feature. It's absolutely negotiable. I don't need to defend this anymore – look at the number of yes votes Bob's proposal garnered despite some very glaring concerns about other aspects of the RFC. > >> Again, if use() is a pain then auto-importing the >> used variables is a good solution. If it's not a pain why are you >> suggesting new syntax? > > > I thought I'd answered this already - because some people dislike the > *verbosity* of "use" (and of the syntax in general) but are happy with the > *functionality*. You are assuming that "I think the current syntax is > verbose" is synonymous with "I think having to list captured variables is > annoying", but there are people who do not take that position. You are capped to saving about 5-7 characters no matter what you do with this functionality. This is nothing compared to what is proposed if you save just one single-letter variable import with fairly customary spacing: $versionA = function($x) => $x + $y; $versionB = function($x) use($y) { return $x + $y; }; That's a 27 character difference (well, 24 if you use tab instead of spaces). Twenty-seven. Please think about that before you respond again.

« previous php.internals (#88618) next »