Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99588 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77366 invoked from network); 21 Jun 2017 14:04:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jun 2017 14:04:52 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 209.85.192.170 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.192.170 mail-pf0-f170.google.com Received: from [209.85.192.170] ([209.85.192.170:34369] helo=mail-pf0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CF/6B-13828-20D7A495 for ; Wed, 21 Jun 2017 10:04:51 -0400 Received: by mail-pf0-f170.google.com with SMTP id s66so85235292pfs.1 for ; Wed, 21 Jun 2017 07:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mindplay-dk.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=MQFnfRUUzrRE2yboAeSEsXbe9I/9otx/0mNwYQ7AYps=; b=WxYg/+GWG98iLjDUiAOorbTI2w7837G00zJF/OirK8sZmR2GZJvegZKTrWJu6dqW1S yeVmosDlPhTUZUvgX5WGWrAeT70chbSD20cBR6K7uoarEREcerDxFJCGG73URwLeHMCZ 0oVQ2kj7mo9QaN2tl8kkxV1tx2W8KLB6eohbRdKSmC7c3cz02SnocXcBBJrsMaqAiWQI wBsdWcfnogATzPsFINC7LVVaRxKAdnH7UT2AQPeCr72kvLk2aL1D8DUTem8D6h1Hdf4s lBgu0TA9WivJ7czhLxyiFbGwtn4b4cpmQqwPxS0cevvXtO7rN/J1vhqOJTA9RIYJJAnJ Isbg== 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=MQFnfRUUzrRE2yboAeSEsXbe9I/9otx/0mNwYQ7AYps=; b=pgSkwhMwjcDhGPsZI/PI21SbkXbuzkKcyJoohuzHi01Abt72yFRo3CSqMwM82OoHZF i97m2XAA46fq7NHHJl+o8TJ7GugTIAhEnSu/9J78qhK0dO1Rysor19hCNnjZojsrqFjm iBtCGsyNvrAFDJ4aYXevyOCZsNvgTfBKK2tvzgZQLhfQ1G7cO2tv85wcNEwSZZy5/nmx jJgY7jhK7W7Bc4snZOvJvwf7KLfv9Ew/JpR4F/1ZN/CBpbvmvlE2ZsOGidKVbPoMpugR ks0snM9mJqHICyIgFYTjPbr6zq7vVXslrvK/hkJ/0p7WDASpfeyZ0bBj5OyrNJB+Zgs7 jTPg== X-Gm-Message-State: AKS2vOzD+Lzf4GoRRfL+ks1bfpLsq5ESjPEwbMm7pjtJ/AtOEbPCR8gA 9d4sUyek3Dj23XcRllufHXQZA/3NTAnDSpn0xQ== X-Received: by 10.98.201.25 with SMTP id k25mr36645118pfg.206.1498053887483; Wed, 21 Jun 2017 07:04:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.151.167 with HTTP; Wed, 21 Jun 2017 07:04:46 -0700 (PDT) In-Reply-To: References: <5fe1eefe-1c4f-4c31-c975-ab6c768c977c@telia.com> <3C763609-54FC-480B-AE95-94A1873226E0@me.com> <9A3447BF-F982-4C5A-B55B-466036AF2E53@me.com> <2d89daaa-056f-3dcb-a5f2-b790affe203a@garfieldtech.com> Date: Wed, 21 Jun 2017 16:04:46 +0200 Message-ID: To: Rowan Collins Cc: PHP internals Content-Type: multipart/alternative; boundary="94eb2c187e24d1ab22055278d918" Subject: Re: [PHP-DEV] [RFC]Discuss] Syntax for Arrow Functions From: rasmus@mindplay.dk (Rasmus Schultz) --94eb2c187e24d1ab22055278d918 Content-Type: text/plain; charset="UTF-8" > For me (and I am not alone), this feature is NOT a new syntax for closures Regardless of why you want it, that's exactly what it is though - another way to declare a closure. Even if it has different semantics, the resulting object is still an instance of Closure, right? It should pass type-checks, it should support reflection, and so on - otherwise, that's even more inconsistency, for no practical reason, and it will lead to an endless list of problems which people will solve with even more ugly work-arounds, such as omitting type-hints, etc. > If what you are looking for is a replacement syntax for existing closures, you will have a completely different set of priorities I am not looking for a replacement syntax, but rather a replacement feature. I think the priorities and requirements remain the same, but for consistency, and to keep this feature generally useful, this feature should have parity with current Closures in terms of capabilities - otherwise it will get in the way rather than help. Once people see the nicer, shorter syntax, and start to enjoy the more natural scoping rules, it's going to be very frustrating to have to back-port to the old function-syntax and add use-clauses etc every time the code changes and a single expression doesn't cut it. A single-expression constraint on this feature would be a strange, arbitrary, annoying, unnecessary limitation. We didn't get it right the first time. Let's get it right this time, not just adding another feature as a work-around to certain specific cases. We have closures - no matter how you view it or describe it, regardless of why you want this feature, this is another way to create closures, and it needs to have parity with the existing feature. Unless you're saying these are an entirely new type of object that isn't an instance of Closure, in which case I'd say this whole feature is guaranteed to do considerably more harm than good? On Tue, Jun 20, 2017 at 7:52 PM, Rowan Collins wrote: > On 19 June 2017 21:22:53 BST, Rasmus Schultz wrote: > >So what's on the table is a syntax-improved but feature-crippled > >variant of > >closures, not an all-round replacement? > > I haven't the time right now to dig out my summary from the mail archives, > but this is one of the fundamental disagreements / misunderstandings that > made discussion difficult the first time: different people want very > different things from this feature, leading to conflicting views on whether > certain things are advantages or disadvantages. > > For me (and I am not alone), this feature is NOT a new syntax for > closures. It is a new TYPE of closure, with new semantics - automatically > capturing variables - for a specific use case. > > Personally, I am strongly opposed to any multi-line version of it, because > I don't want the fundamental scoping rules of the language changed except > for the specific case of simple lambda expressions. > > If what you are looking for is a replacement syntax for existing closures, > you will have a completely different set of priorities. That doesn't make > either of us wrong, but it does mean we're going to find it very hard to > agree on a syntax and feature set. > > Regards, > > -- > Rowan Collins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --94eb2c187e24d1ab22055278d918--