Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105165 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 90154 invoked from network); 9 Apr 2019 13:22:52 -0000 Received: from unknown (HELO mail-io1-f67.google.com) (209.85.166.67) by pb1.pair.com with SMTP; 9 Apr 2019 13:22:52 -0000 Received: by mail-io1-f67.google.com with SMTP id n11so13812702ioh.1 for ; Tue, 09 Apr 2019 03:19:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/SRXvpl4KtM0AWR1lmQZ8ZJ1wOcme5JlpY4JH/SRulo=; b=k3bx/QPj2F9Ad35GM5fEHtGtsK70+ECe3GvF1ipPWJFhAJiSEzrmWVMt7s/D8LghfW qdiBe/zhNzclcLRQanxwLtfuVj92s8kGS9mneFqBQR5csB+Oz22WPz7twACpwWZm69z7 dOnzlCmnVhsOf7rT3H0h2fnHOhrUmLvuV5pVEM4ztVMpoAqt1TUEEuhuYxbY3vjVc9q8 otq3pQqye4wDssquA5FXZk05zbMfJqa8QBWgXTIyCIdbKMdh+LOgK8aqyWbs8+seKQrA wCGm/s3A6B54rhCq7YHGjFM1BHtIFx2n6TZ6IgqMtvthTrCyP2QgL8lvUHXHzJxd7Q4H geNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/SRXvpl4KtM0AWR1lmQZ8ZJ1wOcme5JlpY4JH/SRulo=; b=bZlpG4Iw0C9H8Ezb9QvB8IfPPwMLyT0fmoTSIeNtzxPbu4qSixjeUUW+2zu5mQiaBm 12wnbWZDDMe2vS0DLyGUvv9dzJl54PfE43OkwWFhNpi3Qy11+aMVm2bAoGvDPRis5xm0 1XPTqNCw4yDSVWlnbXXsDiwQhAULS4UmHSuC/MiToPJXM1/gY9KA656ge7ddV+igFr3c ghE3xsVHRdBDlT2RxOd2DUTLmFxR49POlQK5jvdPHRnXBVOLL6D29W/NTbKFRUi9Phvg /fiYP/evDIbnbexbZmuzSDJg/tu1UPU/MwamLELQuWhWXU4WwrcMtzfWGpUmxCbSkuPJ Rwtw== X-Gm-Message-State: APjAAAU9e00gyQm/xxlryLm5PyX2hOZ2JWFgd01wndijMv/e6aqKHvaw nIhHjol8mPIZ0qmPNQiEFnqkLpEnAq5jjp5bsok= X-Google-Smtp-Source: APXvYqxPivNX53HBDOnFo1xe3TkQh1kbWEftqNH4hNRu+4eA338PhuT9B/Ww9uF6+w9/LAFRdW55jwzW8Mr+EOSb7vg= X-Received: by 2002:a5d:9a8d:: with SMTP id c13mr5740535iom.195.1554805183548; Tue, 09 Apr 2019 03:19:43 -0700 (PDT) MIME-Version: 1.0 References: <582b57dc-42a0-582b-9471-2ede97ba584a@telia.com> In-Reply-To: <582b57dc-42a0-582b-9471-2ede97ba584a@telia.com> Date: Tue, 9 Apr 2019 12:19:26 +0200 Message-ID: To: =?UTF-8?Q?Bj=C3=B6rn_Larsson?= Cc: Sara Golemon , PHP internals Content-Type: multipart/alternative; boundary="000000000000a9136a0586164a04" Subject: Re: [PHP-DEV] Re: [RFC] Arrow functions / short closures From: nikita.ppv@gmail.com (Nikita Popov) --000000000000a9136a0586164a04 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 9, 2019 at 8:56 AM Bj=C3=B6rn Larsson wrote: > Den 2019-04-08 kl. 16:06, skrev Nikita Popov: > > > On Wed, Mar 13, 2019 at 4:56 PM Nikita Popov > wrote: > > > >> Hi internals, > >> > >> Motivated by the recent list comprehensions RFC, I think it's time we > took > >> another look at short closures: > >> > >> https://wiki.php.net/rfc/arrow_functions_v2 > >> > >> This is based on a previous (withdrawn) proposal by Levi & Bob. It use= s > >> the syntax > >> > >> fn($x) =3D> $x * $multiplier > >> > >> and implicit by-value variable binding. This example is roughly > equivalent > >> to: > >> > >> function($x) use($multiplier) { return $x * $multiplier; } > >> > >> The RFC contains a detailed discussion of syntax choices and binding > modes. > >> > >> Regards, > >> Nikita > >> > > Heads up: I plan to start voting on this RFC tomorrow if nothing new > comes > > up. > > > > Most of the discussion was (as expected) about the choice of syntax. > > Ultimately I think there are many reasonable choices we can make here, > but > > we should stick to a specific proposal for the purposes of the RFC vote= . > > None of the given arguments convinced me that some other syntax is > > *strictly* better than the proposed fn($x, $y) =3D> $x*$y -- it's more = a > > matter of some choices being slightly better in one case and slightly > worse > > in another. My personal runner-up would be \($x, $y) =3D> $x*$y, but I > > suspect that there are some people who are more strongly biased against > > "sigil salad" than I am... > > > > Nikita > Hi, > > I recall that the perception of the =3D=3D> syntax in the Hacklang user > community was quite positive. Of course it was implementation > difficulties. Are they still to cumbersome in PHP? > > Personally I prefer that one being more readable or the \ one. > Anyway, glad to see that short closures finally is on the road > again! > The =3D=3D> syntax is the other one I implemented ( https://github.com/php/php-src/pull/3945). The implementation is based on lexer lookahead, which is ugly but still manageable. I haven't seen much support for this variant in this discussion though. And of course, if there's no strong preference for =3D=3D>, I'd rather go with the variant th= at is easier for us (and all 3rd party tooling) to support from a technical perspective. Nikita --000000000000a9136a0586164a04--