Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117915 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 35177 invoked from network); 12 Jun 2022 15:08:10 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Jun 2022 15:08:10 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BEF171804D4 for ; Sun, 12 Jun 2022 09:55:11 -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=-0.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 12 Jun 2022 09:55:11 -0700 (PDT) Received: by mail-wr1-f52.google.com with SMTP id u8so4442750wrm.13 for ; Sun, 12 Jun 2022 09:55:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:user-agent:in-reply-to:references :message-id:mime-version:content-transfer-encoding; bh=wjTXjt+rg4Ru9Z09G/M4qESMYpFrZV1IVvmSMCFKbaE=; b=fISetyRkOdv8sOHmAUZuAOTmMAg0LVnuo8Zy6ZLnbak52h+GktUeb1n1GWgk2goL/x axVaJDFBuwzSo2yyiCikoPLabPKTc13QEc3YTgEVlGcKzLHf0UMg5aDSgsTWYl35T3Al jvpQzEsst8xT4jR3VATLaiL6wG8LGd1XVBFhXUc8LaIRSL+DcC6j3Jp1pIJHMeMOcBws GnvtN9CGfgQschOAhdyepHdfa6oEXRIr9y6nBvB5OG+IZbIZD4VIKl5k3CIszvUoV+YJ MESX+B4HPyTP84WYCHnpcxDHS63i9gdyfczshDFpfdm4fP1e2GFSEWjuFavxqkcliSPz vnkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:user-agent:in-reply-to :references:message-id:mime-version:content-transfer-encoding; bh=wjTXjt+rg4Ru9Z09G/M4qESMYpFrZV1IVvmSMCFKbaE=; b=QpK3KgNmEUSU6FxA/OYtR7PQYxVHCnYTwVCI3LiJFqfBK+4Ls+T65ICuc2yvOykbvH jDd3q2Pg36+2UQ+lVgk9bcbzKuajk+8QUullQcKqBT/mMnr4BIaDLayARYyrbaoKJoYF DCyNoCtmqiAn5Ba+24+fegr2OXg3QQyZkGt6ddrM9OciYDnj16oGTwBAspKabbX6A61X RfHVVRUn6XbTxWY5L9JnHs3bXw6o6x3cQq4FzGYfgVbYhOuONYUqMYV2NTjD5fVAJT5e cwsin0OlhS8NvRyu9qsmQzMC1avkP39iC8xr3ZXBywqXr08X98snnpRu8JTNF2G4/lVw Yn3Q== X-Gm-Message-State: AOAM5309ltVQQ5usNnVLt5gLPNbpkm93PDFoPIEpd38wYzuGrbX2g/cB g3neWnanx+xD17FMoWGoc0I= X-Google-Smtp-Source: ABdhPJyK2RAV4tMGzt8Igkya1RTBQsX42ehRga3EWMI12ohNY6/KF/Jh/wCBS1DakbD2YACV/6NhuA== X-Received: by 2002:a5d:644d:0:b0:210:2f75:25f8 with SMTP id d13-20020a5d644d000000b002102f7525f8mr48201253wrw.394.1655052910133; Sun, 12 Jun 2022 09:55:10 -0700 (PDT) Received: from [127.0.0.1] (92.40.196.74.threembb.co.uk. [92.40.196.74]) by smtp.gmail.com with ESMTPSA id c5-20020a5d4f05000000b00210bac248c8sm6036585wru.11.2022.06.12.09.55.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Jun 2022 09:55:09 -0700 (PDT) Date: Sun, 12 Jun 2022 16:51:58 +0100 To: Deleu CC: PHP internals User-Agent: K-9 Mail for Android In-Reply-To: References: <2b35605f-8da8-46b1-aec3-00bd1bfe47fd@www.fastmail.com> <8310f3fd-0011-970e-5379-b2b6e03942b2@gmail.com> <886c9053-4ed6-6e40-3040-9feba6bcbe71@gmail.com> Message-ID: <041414BE-1512-4BAD-B4BB-847BE71CEDA7@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3 From: rowan.collins@gmail.com (Rowan Tommins) On 12 June 2022 16:22:15 BST, Deleu wrote: >> I honestly don't think this is how it will be perceived=2E If this synt= ax >> is approved, people will see "fn" as the "new, better way" and >> "function" as the "old, annoying way"=2E >> > >And to me that's not an argument to deny what people want=2E I never said it was=2E I said that if that is what we expect, we should de= sign the feature with that in mind, rather than relying on the older syntax= as a crutch=2E > Given the current state in the world we're in, what can we=20 > do to have a better DX on anonymous functions? I already gave my answer to that: either add implicit capture as an opt-in= to the current syntax; or add block scope and treat short closures as cons= istent with that=2E >Honestly I don't think it was a mistake=2E It was designed more than a de= cade >ago and there was no way of predicting the future=2E I've seen code writt= en >20~10 years ago and I've seen code written 5~0 years ago=2E I think the b= est >decision was taken at the time it was taken and the world of development >has changed enough for us to make different decisions now=2E I've seen that argument before, but it's not clear to me that anything *ha= s* changed=2E Anonymous functions are used for roughly the same things that= always were, so why are the arguments made when they were added, and again= when short closures were discussed previously, no longer valid? >If someone decides to implement `function () use (*)` on a separate RFC, = I >would abstain from that because it's not something I'm interested in usin= g That's fair enough=2E Just remember that that is *your* opinion of what is= important, and others may have different views=2E >aesthetic issue caused by `use ()`, which is the only place in the langua= ge >we use this construct=2E That's like saying we only use the word "class" when declaring classes=2E = It has slightly different syntax, but "use" is exactly the same principle a= s importing variables into scope with "global", or declaring them "static"= =2E It's entirely in keeping with how scope works in PHP=2E >It seems to me that you agree that there is a chance the proposed syntax = is >going to be perceived as better and people will not want to use the old >syntax anymore and that makes you not want to accept the RFC=2E No, it makes me want to make the new syntax as useful as possible=2E Regards, --=20 Rowan Tommins [IMSoP]