Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98106 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73863 invoked from network); 1 Feb 2017 07:23:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Feb 2017 07:23:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.48 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 74.125.82.48 mail-wm0-f48.google.com Received: from [74.125.82.48] ([74.125.82.48:35686] helo=mail-wm0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7B/C0-51557-2EC81985 for ; Wed, 01 Feb 2017 02:23:15 -0500 Received: by mail-wm0-f48.google.com with SMTP id b65so24843353wmf.0 for ; Tue, 31 Jan 2017 23:23:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=aLd2KkUxwRXldZ53mCp4nSa5Y9jgmuw6gic0wtC30+Y=; b=VTwVMQPbn2NNjN7YKJWPwZ7HXNW6U0UU9tXsGs0vqXoK9hwDVnfrdQA9BGU+d3HzSn GPYmk3jhqCAgO0mq92CBhbBOojI4qTcIrbcpTSlVZVlMrNZd4beSVsEdVQxBxzlcS/nI dci/tBPC/aKt9T/wf+ZwZMjeTfYPb8ogC2eyn+qd/HN3zNfDUPxMGkXpfLrt6oRK0HpJ IpfuFTSTnn1gtGUy0F8m4bzvPIaBoxP91H2I0mAA04JNhIz6uuGETrh2mbaJ0f/w/2Uk JVLLAYtzAPgDZA0y2tsGJDb2+oXNOyjHkEByQDO3ykmKg36n/pNhf1yTCy0OY9d4hT+x Sm5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=aLd2KkUxwRXldZ53mCp4nSa5Y9jgmuw6gic0wtC30+Y=; b=M6GK6Wm40sjrt3qq+ibu5BY1U9yC7GDFj171N7P6Y+koo5auDD++mEBzWgFfsWyAzk OzpuoAJtdLDSVC5d9skMeUjBnEh2uyUj1WkgGv8GD52DZGzbX5CdgxiG5q0XqedGNKGj QJIlVd1Gu9fvlvPZY0mTYzeWufudov9+A0mbAu4dAmk9+uOKM8NVaWNvzg1Rpw2wSITR /vSboA7yWHmoXIiJBqMzOZCpQXVUgvXwLytucUe7PDbdmIXSLh+3XkUv/4p+gXtjXNAA 3MsV1G4BAh57cYgfmxAiZ3y0t3DlxkYroJ5ry1LnNPQf10Os+6LIkjHR1rv3jBZ1EE9m nPeg== X-Gm-Message-State: AIkVDXKJkCBfjXJEyMpJCybd7FQ24bfTP0aY06q5tUbiBTS3IFOTYPr1q/Uanq3zKb1/8pOLtg22UJL8lP3nmg== X-Received: by 10.28.5.70 with SMTP id 67mr21270828wmf.32.1485933791754; Tue, 31 Jan 2017 23:23:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.34.167 with HTTP; Tue, 31 Jan 2017 23:23:10 -0800 (PST) Received: by 10.194.34.167 with HTTP; Tue, 31 Jan 2017 23:23:10 -0800 (PST) In-Reply-To: References: <3F428CA4-8211-44E6-9B60-62ADB47934B3@koalephant.com> <642a72cd-e322-0b22-452f-dfbd521aee02@php.net> <37679ae0-eb90-2367-7fc0-8f0adf97a965@garfieldtech.com> Date: Wed, 1 Feb 2017 08:23:10 +0100 Message-ID: To: Bob Weinand Cc: Larry Garfield , Michael Morris , "Christoph M. Becker" , PHP internals Content-Type: multipart/alternative; boundary=001a11443a36d1438f054772eb38 Subject: Re: [PHP-DEV] [RFC][Discuss] Arrow Functions From: ocramius@gmail.com (Marco Pivetta) --001a11443a36d1438f054772eb38 Content-Type: text/plain; charset=UTF-8 Just throwing it in here while commuting, so it's a top-post with no references. Saw it yesterday on reddit (!!! Reddit being useful for once !!!): $callback = |$x| => $x ** 2; On 31 Jan 2017 22:44, "Bob Weinand" wrote: > > > Am 31.01.2017 um 19:41 schrieb Christoph M. Becker : > > > > On 31.01.2017 at 19:16, Michael Morris wrote: > > > >> On Tue, Jan 31, 2017 at 12:29 PM, Larry Garfield < > larry@garfieldtech.com> > >> wrote: > >> > >>> My question is why there's no mention of HHVM short closures, or the > >>> previous RFC to take that approach. See: > >>> > >>> https://docs.hhvm.com/hack/lambdas/introduction > >> > >> For what it's worth I'd rather look at > >> > >> array_map( $x ==> $x + 1); > >> > >> than > >> > >> array_map( fn($x) => $x + 1 ) > >> > >> Not to mention the former isn't a bc break. > > > > Neither is supposed to work, though. :) > > > > Anyhow, I'm not sure whether I'd prefer > > > > array_map($a, $b, $c ==> $a + $b + $c, $a1, $a2, $a3) > > > > over > > > > array_map(fn($a, $b, $c) => $a + $b + $c, $a1, $a2, $a3) > > > > or maybe > > > > array_map(fn $a, $b, $c => $a + $b + $c, $a1, $a2, $a3) > > > > Somehow, I tend to like a trailing keyword for better left-to-right > > readability. > > > > -- > > Christoph M. Becker > > The RFC states that we're needing some form of a prefix in order to avoid > implementing gigantic lexer hacks. > HHVM internally implements it by parsing some part of the syntax INSIDE > the lexer and then emitting a token before the first parameter to tell the > parser where a short Closure begins. > Having a normal terminal symbol easily allows the parser to detect short > Closures, without any hacks. > > It is just not a practical option from a technical point of view, and thus > not worth even considering. > > Bob --001a11443a36d1438f054772eb38--