Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113826 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 19293 invoked from network); 28 Mar 2021 11:34:02 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Mar 2021 11:34:02 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ADA43180503 for ; Sun, 28 Mar 2021 04:30:47 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-il1-f170.google.com (mail-il1-f170.google.com [209.85.166.170]) (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 04:30:47 -0700 (PDT) Received: by mail-il1-f170.google.com with SMTP id j16so362068ilq.13 for ; Sun, 28 Mar 2021 04:30:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=g090CgDSh427KAHOz6eTvjjargK3/pfnTsqXOrGBkz8=; b=jHYV1OVOnnzmH34QTETM+XCCIP6+B2nYSoP7mhYbYzRJ7jNYdrhqucImT93JD80gMv dusDHQessZEyAQzjW8Z5D2ZQwfod4gsFqcJJYHMwjNxzmqkd1lHZATFBWDX+eS/P/so7 gDpzFjAwFelWTaKCoi6FtKpoB1putw/zbpaFKYUtYJa1tuAb2caIyTuS5+GETppGY9Ta 5kjzdSXsJIwtN4dpYVpcbyu+RGn5evLe24nd/RzFuUO1BZFSbKP725fKL7qNqe6pal+8 hLdjQWbOPMFRH+bAaLy3clAY2X8+9u69LVsDNThVpuDsk+6jA5fphX1jHKKuf/w6EffS mOeg== 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; bh=g090CgDSh427KAHOz6eTvjjargK3/pfnTsqXOrGBkz8=; b=Lfp5WUM3JMbZF0iA2+96dBWPeQZ2UGQICvCArZ23l1F4BsgG/KO0/AC7/VzKZ0AMYB /a4G9RLefQf7eD5E3o644dDSuVfRgxxGWH6tzgCEbU6Z2ugSBNkkza7gXRISlTS3x85z gxcgzsB+Z+TcoIxoTiZp2WiJM2qRR93LRqR233K35bMFAVTYzMsMwjpNaBUjKQCGuPBJ JfG2R4dCm0iIq7NGylB7eqGBK8GCNlvabYvZtVVh3w/4EuazMme53pKXfIsrvfaZ++MA MYg5+wWx8al40akoNt4EZey4v3LmK/5jA6PNR4RYaM9ml9MrmR1dPfg0qZiYfCxSM9s2 jsLQ== X-Gm-Message-State: AOAM532PDmaxeN6wUVAf2BjD3MIvi1Tn5JT0EDJ8rzywb8ntQ6oCQDE+ HBc2wQRKyhoGJhgD8RerSECazE+LCcz+UVWKItI= X-Google-Smtp-Source: ABdhPJyhFoyX3BJ0/CJ/3QK8e9XzAmAf/l46BP8QdQqAOj2l8TsxyZ8L1SBJpyX/aSKz33TUFM4famnpjPqg8FAyHlw= X-Received: by 2002:a05:6e02:f07:: with SMTP id x7mr11678573ilj.242.1616931045050; Sun, 28 Mar 2021 04:30:45 -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:30:32 +0200 Message-ID: To: Kalle Sommer Nielsen Cc: Rowan Tommins , PHP Internals Content-Type: multipart/alternative; boundary="000000000000910cf605be9718c9" Subject: Re: [PHP-DEV] [RFC] Auto-capture multi-line closures and shortfunctions take 2 From: deleugyn@gmail.com (Deleu) --000000000000910cf605be9718c9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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. On Sun, Mar 28, 2021, 12:21 Kalle Sommer Nielsen wrote: > Den s=C3=B8n. 28. mar. 2021 kl. 13.02 skrev Deleu : > > > > This would lead to inconsistent behavior in the language when short > closures auto capture without the auto keyword while multi statements > closure doesn'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/mailinglist-= rules.md;hb=3DHEAD > > regards, > > Kalle Sommer Nielsen > kalle@php.net > --000000000000910cf605be9718c9--