Re: [RFC] Short syntax for anonymous functions

From: Date: Tue, 19 Feb 2013 16:45:26 +0000
Subject: Re: [RFC] Short syntax for anonymous functions
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
>> Say we agree on the syntax above
>>> ($n) |$m| => $m * $n;
>> What happens when my one liner function needs to do one more operation
>> like checking the value of $n before multiplication?
> 
> As I stated before suggesting the syntax: It's only meant for a single
> expression. It's purposefully NOT intended to cover multiple
> expressions.  In that case the current (verbose) syntax is better for
> all criteria I care about. Additionally, neither Python nor Dart
> allows multiple expressions in their short-syntax functions.

Have you considered how this will work/look in an array?

$a = [$b => ($n) $m => $m * $n]; // wat.

S



Thread (65 messages)

« previous php.internals (#65968) next »