Re: An implementation of a short syntax for closures
| From: | Rasmus Lerdorf | Date: | Thu, 04 Aug 2011 07:23:30 +0000 |
| Subject: | Re: An implementation of a short syntax for closures | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-54335@lists.php.net to get a copy of this message | ||
On 08/04/2011 12:08 AM, Lazare Inepologlou wrote:
> $add = | $x |=> | $y : $x |=> $x+$y;
This does not seem to match the syntax of any language I know of so
people are going to have a hard time figuring out what this does. It's
not even clear that |=> is a new operator there due to the dangling |,
which as you say conflicts with the regular | operator. Plus it is only
useful in one limited type of trivial closure usage.
In PHP we try really hard not to invent new unfamiliar syntax. We try to
stick with things that have some basis in either the existing syntax or
in other popular languages that the average PHP developer might be
exposed to.
-Rasmus