Re: [RFC]Discuss] Syntax for Arrow Functions
| From: | Fleshgrinder | Date: | Thu, 08 Jun 2017 15:56:53 +0000 |
| Subject: | Re: [RFC]Discuss] Syntax for Arrow Functions | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-99456@lists.php.net to get a copy of this message | ||
On 6/7/2017 9:45 PM, Rasmus Schultz wrote:
>> the
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
fn($a, $b) => $a + $b ** $c syntax suddenly becomes
>> an acceptable
> compromise.
>
> I have to second that.
>
> I might even propose to shorten it from "fn" to just "f" - the resulting
> syntax then resembles a mathematical predicate :-)
>
I really like your thinking here. +1 for just f.
I am not sure why we would require the fat arrow anymore. We most
probably want some symbol there to separate the return type constraint
from the body, but it could be a single symbol instead of two:
f($x) = $x^3
f(int $x): int = $x^3
We could go full math here! :)
--
Richard "Fleshgrinder" Fussenegger
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc