Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113824 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 13045 invoked from network); 28 Mar 2021 10:24:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Mar 2021 10:24:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DC9D61804DF for ; Sun, 28 Mar 2021 03:21:08 -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.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (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 03:21:08 -0700 (PDT) Received: by mail-pj1-f47.google.com with SMTP id k23-20020a17090a5917b02901043e35ad4aso6318625pji.3 for ; Sun, 28 Mar 2021 03:21:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=XX8HZBHBdKUZGCXrtBTZ1hCHHD6302HMb+J1f1Y5Tek=; b=fQ+Yk71bOOpkwzB/PN6OZ50Fczbyw+YxOU8ZvQW9FkFKfkuRS29gsKclPADU4vYLN7 /RVVLazOKyW5ZaPc+csMWyTHZ9kpAi7uw83rPklGeMzsnU5dx5nksQ/VGiM3PIzAwnEU WTo3/5C5ZBKzdfyzANIaSN5Qp2XXcBYCEawCaO41a+QpEMYkSbhhjFXZoEStN0a4TE1a K7+Jh4nFAcmiW8vJqhxWKqfhnx2+svh8BHeqecaNG5G4abG3DkpCcOMacra5H7OjYKOy eRNIrHY5yyz4HS1z47LiLdwXtZmP0h6hfQbjT3J8hoSbv6bDs5gVHyG9sUHWl57g0L9u RZzQ== X-Gm-Message-State: AOAM530+V7DKibE5vv6Tb/mxVotxgdiEq36sHcQ6mUwQ7FSs3fBsXDQc 5GueFD1H3dCN06I4dTKQWdl+j/qg1yOC1qtZWq4= X-Google-Smtp-Source: ABdhPJzHguoPHRIecdqnRoRatiLdkOExfzHVdg2NIiM7UczqyY53oDMba+qBYLjVgiKhij74zrz0K47L+ok8kWh63ls= X-Received: by 2002:a17:902:d486:b029:e6:f007:706 with SMTP id c6-20020a170902d486b02900e6f0070706mr23761234plg.83.1616926865751; Sun, 28 Mar 2021 03:21:05 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: Date: Sun, 28 Mar 2021 13:20:54 +0300 Message-ID: To: Deleu Cc: Rowan Tommins , PHP Internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Auto-capture multi-line closures and shortfunctions take 2 From: kalle@php.net (Kalle Sommer Nielsen) Den s=C3=B8n. 28. mar. 2021 kl. 13.02 skrev Deleu : > > This would lead to inconsistent behavior in the language when short closu= res auto capture without the auto keyword while multi statements closure do= esn't. > One of the best features of these RFC are their cognitive definition that= is clear, concise, consistent and simple. (First off, please read our mailing lists rules[1] and do not top post) If we go by the inconsistent behavior then by that definition short arrow functions are inconsistent with the rest of PHP as there is no auto capture elsewhere. This is not short arrow functions being expanded to support multi lines, but rather the other way around, with multi line closures being able to support auto capture which is identified by the `fn` keyword and because of that, I would much rather have a `fn` be an alias of `function` and then having the ability to put a keyword to declare that you wish to use auto capture (which is consistent with the exisiting design of PHP where you have to declare globals with the `global` keyword or explicit imports to closures with the `use` statement (which used to be done by the `lexical` keyword similarily to the `global` keyword in early PHP 5.3.0 development) -- if you are interested in this philosophy you can try lookup videos from some of Rasmus' presentations where he explains his dislike with globals coming from C). To back this up further, we also have the `static` keyword which acts as a feature flag so it is not unnatural, the naming of the keyword `auto` sure, but that is another discussion. [1] https://git.php.net/?p=3Dphp-src.git;a=3Dblob_plain;f=3Ddocs/mailinglis= t-rules.md;hb=3DHEAD regards, Kalle Sommer Nielsen kalle@php.net