Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113830 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 30354 invoked from network); 28 Mar 2021 13:39:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Mar 2021 13:39:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CA27E1804E2 for ; Sun, 28 Mar 2021 06:36:33 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 28 Mar 2021 06:36:33 -0700 (PDT) Received: by mail-qv1-f49.google.com with SMTP id cx5so5222564qvb.10 for ; Sun, 28 Mar 2021 06:36:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=W5+12AFVrBS+vN2MxioxgWGTdhnhdZyyqlLl5eDT+GA=; b=lkiHfGF4Wqob3Xn8RNr7g+RQ/BPhLuZM1ShxAsNOM0F1MzYKVyioKOepH796XlAf0I NDFK+4HUTlRhtgMex9Rwo4idFW/KGLe8Ceh81/AJ6SPxi0hZJi6rJR1wMuTdr6Dlzqr3 DSqWDrguNFpnCSBfV0g1GFZV97EX11Nl1PYVuHUSnyNP4rOF3UwnJNYw3C1FLzwOBXqi myO45dKjGV6eLQgeQsaROOE6lnrexAPexfGvjHbZ/Xw/p2PVIx1g6kWFFJMZlBzoh7/l ypUCvswUMJMLqpH9j+KpSirulrhUVSOGlvnVfcaAATtSz7MYzDcTkRGo3HrXLY2SY3jB Kerw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=W5+12AFVrBS+vN2MxioxgWGTdhnhdZyyqlLl5eDT+GA=; b=fxPmV170tSf3qDKJSjtYeiYuHED6QceLBJT8QmcwyZ2ilAjS4uV87xOLIda8d7W0WI MPN5C1K/Qhzr3dGctxD6SlF1O6LHFQjl6zGTOXnt+nZSXqMrVqGkDd+mev5teERjagoZ e6EdFyv0bwU1bx7E43sKYsYF/xtgxbnmn+LpndjjJ6lHyLHb1GxgDwJE7LwjMw382KbF UQwA9junyE4BLpQl4erzgcLq2ZxQMBT6BWTg3GReA4j9Z5USiHrtW/vmqCBDoGiJdRpB dSeUMbpiNpLIRmldXP9uKbS+fMeM4+Mu7cw76TL1RHyZ7ekJm3l4usKRJJBDkXpjwPMX f5ww== X-Gm-Message-State: AOAM530FfTynhXiEPAJ5aOibzl7vk9/gr/CuT/Dxjvlp6a2mIgomXEqy H8wnEabHb1YRhcizRgTIxrJGeMxc8T1R1U2B X-Google-Smtp-Source: ABdhPJybmJwYZTzw3WhBHvM+S0WjjSUwpNxh96rGqGNqWdoyYiSNwiGKA8ucI07RlPAWKFMTSb9dEg== X-Received: by 2002:a0c:e8c5:: with SMTP id m5mr21052859qvo.13.1616938591660; Sun, 28 Mar 2021 06:36:31 -0700 (PDT) Received: from [192.168.1.239] (c-24-98-254-8.hsd1.ga.comcast.net. [24.98.254.8]) by smtp.gmail.com with ESMTPSA id v6sm10564271qkf.132.2021.03.28.06.36.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Mar 2021 06:36:31 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) In-Reply-To: Date: Sun, 28 Mar 2021 09:36:30 -0400 Cc: PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: <48ACB47A-76FB-414A-BEA4-9C224F005D13@newclarity.net> References: <88c9eb5f-f80c-4869-b7f8-1b58b9e2eaa3@www.fastmail.com> <605bae82.1c69fb81.f49f7.d11eSMTPIN_ADDED_MISSING@mx.google.com> <919e30e7-3e5e-d955-7bb4-1e1b5825cdd1@gmail.com> <635DD146-FC6F-4991-8D2C-5A6B492722D5@newclarity.net> <734f12de-da98-6b76-c2fe-8682f4d177aa@gmail.com> <36E45DD6-E2BD-4801-BAAE-4355C83D1AC3@newclarity.net> <15AE4315-A456-4ED8-990A-49EBD76C5B46@newclarity.net> <5501FE70-FBED-47EB-8010-173644BC064F@newclarity.net> <3d453ce7-db16-fb75-91b4-9a2a71994164@gmail.com> To: Kalle Sommer Nielsen X-Mailer: Apple Mail (2.3608.120.23.2.4) Subject: Re: [PHP-DEV] [RFC] Auto-capture multi-line closures and shortfunctions take 2 From: mike@newclarity.net (Mike Schinkel) > On Mar 28, 2021, at 8:04 AM, Kalle Sommer Nielsen = wrote: >=20 > Den s=C3=B8n. 28. mar. 2021 kl. 14.30 skrev Deleu = : >>=20 >> The fact that short closure is inconsistent with the rest of PHP is a = done deal since the voting passed prior to 7.4 release. Unless there's a = follow-up to deprecate the 7.4 short closure auto capture without `auto` = keyword and make it look like PHP can't make up it's mind, I feel that = your perspective doesn't match the proposed RFC. The RFC is extending = short closure to support multiple statements and defining good semantics = on how developers will interpret fn, =3D> and {} throughout the = language. >=20 > I think we have some sort of conundrum. I am not saying auto capture > is not good semantics if that is what you are implying, I more than > anyone would like consistency in the language but it is not a good > language design to have two very similar features separated by a > shorter keyword which implies totally different semantics. I don't > find this a very intuitive way nor a good developer experience. I can > understand that the connection of the `fn` keyword already having the > meaning it has, but then we can bring up the side running RFC from > Larry which proposes to make the same short syntax available for other > function declarations, how would this work then with this mindset of > `fn` meaning auto capture? Does that mean a procedural function > declared with `fn` will now inherit the scope from which it was > declared (usually the global scope)? What about methods declarations, > do they import properties into the local scope? How does traits > interact here, same as methods? >=20 > This is why I think having the `fn` being an alias of `function` > neutralizes the argument of what happens for exactly those reasonings > above, this allows arrow functions to continue being auto capture > without any keyword. I am curious how requiring developers to learn that "=3D>" means = auto-capture and having developers question when they should choose "fn" = instead of "function" when the answer is "it does not matter" is a more = intuitive and a better developer experience than requiring developers to = simply learn that "fn" means auto-capture? -Mike