Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99249 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87560 invoked from network); 30 May 2017 02:49:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 May 2017 02:49:06 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.171 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.223.171 mail-io0-f171.google.com Received: from [209.85.223.171] ([209.85.223.171:33244] helo=mail-io0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FE/FA-34073-E9DDC295 for ; Mon, 29 May 2017 22:49:04 -0400 Received: by mail-io0-f171.google.com with SMTP id p24so49287253ioi.0 for ; Mon, 29 May 2017 19:49:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=70BZms9nuv6fThwGNGHXHx3FEigdMY/RnWyud77mBeY=; b=FK76e3VUT/PIQ1k6iZxb/rWsnDwKvzg8MEWMOZKR53/zKwlW5j7KXJjFGfvywKjkEF XWC9ujULxxPwhJxBRF5PvDIjwiPghdLRPQGEvgd/qiX2sdQJluT6XPpJJeQpCiuIKTMo UovUtIGj4lc8U/xrCbLNaN0bbin3Et3kKEDvfwrQfPH7pCGBjGQWg/LXuAyEVglHdGVh L1qRAumfxlb0dPgww3xT5efQtF8FMV7vf98AS4o1dGg0NDWHAI0DshDh45Pst3vaMpRB GmnaiBM9dQW7IO7OxwqGFU3cNsxYQCII5IwF9LR9SB2WPKUitrvgdiD0CpQjnnzdZd1G Q3UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=70BZms9nuv6fThwGNGHXHx3FEigdMY/RnWyud77mBeY=; b=i4dRCOIPMFdArkW/IzxBZJ3NVI4dALo3HVqPTnc6YJxrcXmShnqLfTFTP53putyALd jnvweI7DoZoUiPhFhjWsLL6zJ6I3YOVxut+M4HMqsz+e/83jsuywioL81h4nUVyVxlJm Bo3R9K8RAXrU/Jiqmv/f0geJSq1WcCeCexwGNFO1lU5WcNEhJOQpUeRmjCE/qgCCBgHL 4H7wDrTySAbp1hVF4FF8WipEu4RlGF3bQPJUxJPQfDcuM5qxi4YPWjp9VuboChopNw+h 6dHbDgfEmBOOW/rzbmMdSFN2/FL/gfFGYx7oAD0gGHKgYRGhiTGx/KmiSx/6CsaNrccw 5ReQ== X-Gm-Message-State: AODbwcD65M03mZFpSmYpG021zYu6uBFJJpx6fcddAq5QdQCYa1gIyAca w5KE465Pb1bWdPS+tFOfHfla7X/qfsRSDrg= X-Received: by 10.107.174.157 with SMTP id n29mr16314223ioo.39.1496112539854; Mon, 29 May 2017 19:48:59 -0700 (PDT) MIME-Version: 1.0 Sender: morrison.levi@gmail.com Received: by 10.107.12.159 with HTTP; Mon, 29 May 2017 19:48:59 -0700 (PDT) In-Reply-To: <877970f0-b22d-a8b9-9ad4-6fc9139a9b34@telia.com> References: <97bb5051-6413-b78a-e981-ad8858caec4c@gmail.com> <8d4ee559-1ad2-4d65-ae4f-207e59f056e3@Spark> <61DC1C28-CAF2-45F4-8D9F-A66BEA2E90B1@gmail.com> <3942113e-f83a-444f-bbc2-462c70d67c65@Spark> <20db9b97-5313-057d-db56-920ccb758558@telia.com> <877970f0-b22d-a8b9-9ad4-6fc9139a9b34@telia.com> Date: Mon, 29 May 2017 20:48:59 -0600 X-Google-Sender-Auth: x5JJpgJYfgtdYRJ8yZfXETqm828 Message-ID: To: =?UTF-8?Q?Bj=C3=B6rn_Larsson?= , internals Cc: Sara Golemon Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC][Discuss] Arrow Functions From: levim@php.net (Levi Morrison) On Mon, May 29, 2017 at 4:47 AM, Bj=C3=B6rn Larsson wrote: > Den 2017-04-05 kl. 23:57, skrev Levi Morrison: > >>> Any plans to go with this for 7.2? >> >> I have been working on this RFC a bit in the last two weeks and intend >> to start voting within the next week. > > Any hope this one will make it into PHP 7.2? > > Of course maybe it's prudent to have some more discussion > and then it's 7.3. > > Regards //Bj=C3=B6rn Larsson > > PS If there is some writing needed for the RFC itself maybe I > could assist, need to get an account & karma first though. Based on the discussion there are a few different syntax choices that we probably just need to vote between. It's a feature that people seem to want but everyone seems to prefer a different syntax choice. 1. fn(params) =3D> expr 2. function(params) =3D> expr 3. (params) =3D=3D> expr 4. (params) =3D> expr Note that 3 and 4 require a more powerful grammar and parser and that 4 has ambiguities. I think we can work around them by rules -- only mentioning it because its popular because of JavaScript and do not prefer this at all. Note that 1 requires a new keyword. Option 2 looks the best from that perspective but is by far the longest; remember people are partially interested in this feature because they want shorter closures which this doesn't really help. This is why everyone is so divisive. All options have drawbacks. Additionally some people don't like binding by value and would prefer ref, and others really would be against by-ref. Which brings me to an option I don't think was ever discussed on list: 5. [](params) =3D> expr // binds no values [=3D](params) =3D> expr // binds by value [&](params) =3D> expr // binds by reference It has quite a few good qualities: - No new keywords - Can choose between reference and value - Concise - Has precedence in C++, a major language - Can be done in our existing grammar and parser[1] And of course it does have downsides: - Symbols soup (it uses a lot of symbols) - A minor BC break; the following piece which is guaranteed to be an error would now have meaning: [](optional params) // previously an error Overall I'd prefer 1 or 5. What do you guys think? [1]: I'm pretty sure it can be done but until it's done I can't say so confidently because sometimes there are things lurking in our grammar I forget about.