Re: [RFC]Discuss] Syntax for Arrow Functions

From: Date: Wed, 31 May 2017 13:48:03 +0000
Subject: Re: [RFC]Discuss] Syntax for Arrow Functions
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-99296@lists.php.net to get a copy of this message
On Wed, May 31, 2017 at 7:36 AM, Rowan Collins <rowan.collins@gmail.com> wrote: > On 30 May 2017 18:58:14 BST, Levi Morrison <levim@php.net> wrote: >>Internals, >> >>The previous discussion thread has died down significantly and so I'd >>like to start a new one to refocus. This message has some redundant >>information by design so people don't have to reference the other >>thread so much. >> >>Based on the discussion there are a few different syntax choices >>people liked. Overall it's a feature that people seem to want but >>everyone seems to prefer a different syntax choice. > > I was just pondering alternative approaches to stop the => token being ambiguous, and > wondered if surrounding the whole expression with braces could work: > > { => $bound * 2 } > { $a, $b => $a * $b } > > I believe this eliminates the ambiguity with array notation, and is more concise than pretty > much every alternative. I'm my opinion, grouping the arguments and body would make it more > readable in context, as well. This does not work. We permit expressions as statements and we also allow empty blocks: { $a = $foo; } These will conflict in the grammar.

« previous php.internals (#99296) next »