Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99383 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39221 invoked from network); 5 Jun 2017 20:14:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jun 2017 20:14:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.45 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.45 mail-wm0-f45.google.com Received: from [74.125.82.45] ([74.125.82.45:38330] helo=mail-wm0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/28-27119-A8BB5395 for ; Mon, 05 Jun 2017 16:14:03 -0400 Received: by mail-wm0-f45.google.com with SMTP id n195so84888251wmg.1 for ; Mon, 05 Jun 2017 13:14:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=yNtzZPmsZEBq2B1M1Ww+4/JNjU6xXYz2yseeVCNBQOg=; b=qqEvyNjaGnka5lKK4SkULyUXRAeiu9FB0eydo/fg9j0VRKh7B4298Whz0lpqyBEH8j Dopc7IbljHlolTrIhF5Wi9GG8IWlHwJnRmi4RynxMUDxDnxLksD2ekjRyNGprx3CUKIN X3B+KtnjzoRmSyOT6e8TMWQBOH25oPZJGYZQvnWB0eKgxskuB4dXB4RYfwXFZp27mqGu OTJRMiwDsC1OdM/giFn3c36H2RoydHqXi9x+3U/v3VXt0+v9hr2Y8CmYdk2WCmfDPe/y x66E+j3sTudNpiWl67I3q2Dqpel6XAX0KNhAy1yIWghXYSZE2vwqNhenNomKgIylEy13 cDLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=yNtzZPmsZEBq2B1M1Ww+4/JNjU6xXYz2yseeVCNBQOg=; b=WCb0wr62AqZNGUOu9+RJlEOeaES3CInxz5yOqpuaaGyTLwX0gs2BrIj6hKKcn6sRPJ GWa+lSiHoGeVh70Om2iloEilEt8sShaXW761ctKBsVGvhAqcwKW7Cs4kP3fi3RmO0r5f 0BKGVQhf7zGMKuWbDwiucDYttZdXIkl10xnQMn1Sd0ZaAK33XLoE9/9w5OK0TARO2/Gp NcbeV85YaH6rQ4JDAnG3QgupgqM01DI87mX0sPhBpWfHLdAwTGlv1g40wzeDL0wHprfB gTC2M27KbJwNowkOTLOS5L3sguJTlWcxL1kgs127NUz2tw8mMjl8nUFPqHfGeJYr3/h7 PtqQ== X-Gm-Message-State: AODbwcAtFAM0pNP+GE9KrqYNfvOgq/9psMkT7EiYseofrRkzlnZlWR/y FbSiT5sqNecUZ2Nc X-Received: by 10.28.86.194 with SMTP id k185mr9379916wmb.35.1496693639285; Mon, 05 Jun 2017 13:13:59 -0700 (PDT) Received: from ?IPv6:2a00:23c4:4bd2:6e00:cd3e:5b74:a1fb:eca6? ([2a00:23c4:4bd2:6e00:cd3e:5b74:a1fb:eca6]) by smtp.googlemail.com with ESMTPSA id z12sm42182051wrb.41.2017.06.05.13.13.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jun 2017 13:13:58 -0700 (PDT) To: internals@lists.php.net References: <6357d97c-3f2e-4cf8-cb1f-cb7f7ccccf7c@telia.com> <7eaef49b-bf60-9aa1-e812-8430164e3178@garfieldtech.com> <3F920987-38CB-42DD-888D-824430C36F14@gmail.com> <2f9e73c9-444a-11d0-459a-e261ea8a7080@telia.com> <4077c099-2247-c3c1-7dee-02a6b25f8586@fleshgrinder.com> Message-ID: <6af2f76a-44d1-2e04-3f22-6c4722ee2b2f@gmail.com> Date: Mon, 5 Jun 2017 21:13:56 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC]Discuss] Syntax for Arrow Functions From: rowan.collins@gmail.com (Rowan Collins) On 05/06/2017 20:09, Fleshgrinder wrote: > How about ~> which I at least cannot think of any place it is used at > all. ~ in binary negation and the only place we use it (I checked the > language parser this time to make sure). We've come full circle: that was actually the syntax proposed in Bob Weinand's (rejected) RFC two years ago: https://wiki.php.net/rfc/short_closures There are several reasons the RFC was rejected, but IIRC the syntax was one of them. I think ~ isn't available on all keyboard layouts, and some people just didn't like the look of it. Looking at earlier drafts of the current RFC reminds me of a couple of points which have been slimmed down a bit in the current edit: 1) As well as inside arrays, => is used to represent key-value pairs in yield statements: // Does this mean: // 1. Yield a key with the result of `($x)` and a value with `$x * 2` // 2. Yield an anonymous function yield ($x) => $x * 2; 2) The prefix (fn, function, lambda, etc) allows us to insert type hints without adding awkward complexities to the parser: > In the definition (Type &$x) => expr the part (Type &$var) can parse as “take constant Type and variable $var and do a bitwise and & operation.” > After that the => will be an unexpected token. Even though the rule would be invalid the parser doesn't know that far ahead there will be an error and it doesn't know which rule to pick. Regards, -- Rowan Collins [IMSoP]