Re: [RFC]Discuss] Syntax for Arrow Functions
| From: | Fleshgrinder | Date: | Thu, 15 Jun 2017 13:34:03 +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-99529@lists.php.net to get a copy of this message | ||
On 6/15/2017 3:29 PM, Björn Larsson wrote:
> Seems like the constraints on this feature makes it hard to fly, i.e.
> 1. Not a hackish implementation
> 2. Non ambiguous syntax
> 3. Easy to parse & use syntax for the human
>
> HackLang then prioritised 2 & 3 making the end-users happy, but
> had to sacrifise a clean implementation. Any clue if this was a one-
> time effort once it was done or something with a lot of drawbacks
> in terms of maintenance, performance, evolution etc?
>
> r//Björn
>
On Reddit someone proposed the following syntax:
\() => echo 'Hello, World'
It is used by Haskell if I remember correctly and should not be
ambiguous since
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
( is not allowed in names of classes or functions. It
actually aligns well with functions that are called with a
fully-qualified name (e.g. \printf('')).
Not sure if it would still require hacks though.
--
Richard "Fleshgrinder" Fussenegger
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc