Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112186 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 79413 invoked from network); 4 Nov 2020 22:44:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Nov 2020 22:44:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8AB5E1804B5 for ; Wed, 4 Nov 2020 14:05:40 -0800 (PST) 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-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) (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 ; Wed, 4 Nov 2020 14:05:37 -0800 (PST) Received: by mail-oi1-f176.google.com with SMTP id j7so23819188oie.12 for ; Wed, 04 Nov 2020 14:05:37 -0800 (PST) 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; bh=tqhBBUIP2P21k5CXkk2+apfdaMJgHl70zBew5YDZzyU=; b=qPxQV8bOFW3MIMwgmlpXdkPQS8n3emwr18AwYvkusZ5j136tllFcu1i8p4462kYm1f gCtSPg6tjo1YTFuHMNHeusOp38zjorVMmRF8kH8+h7CXfJcTQpu2SOENiMZgIIDw+TC1 V8916lxOnG8R7yjfmMFqGY4GGMTObWWv9Bgwf8wf7cxpuIUrqqFlGoSVNhl1Of+JvFK1 jaumF+OdFOHIkb1rGJ93Vk8Wlq8nCNPh9MbAWqogPRHsPrhGXz+SxvgJopTzEp1ic0c6 6V/NPas6JFfnsnbpyfNEwqWqTGGjl7L3dMJLA6eZH0llOtqkU+b+H1CCPh+7mviaB+y4 0+pg== 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; bh=tqhBBUIP2P21k5CXkk2+apfdaMJgHl70zBew5YDZzyU=; b=qslP6r+CWLwsoKQ3e03E9ZvD4mybNttKKLknxGKLxMkiGAjy+Y2qBh89dx1TiSho6N MFIbdfUazSlGEI0a7ITvF6b4frgkLNeHNPGjvZ7bIhsYGSe3scyX0orZ07R2Q0aBENsL S6zwhlcinsufIKvcx15rsE5MxEtjY1Rczd864niybCrDe+N4YlhJNwqUFQzoIf1hOjJS t3iwcwRtDwUaxjx5Ubk150YRmGf7UGXBlUfBF+Cx47Xs9PLYM3aJAs3qLSz5DukeYUkt 7wmgUL+lLsRj7S86fG99mHc1Ba80fcSLbQWmyDkkHItjigLeWxyGhQ1C9kqgK7y94Z/Q yvkw== X-Gm-Message-State: AOAM530Ahpi1S8jRcUqo9f1oSeNcD2XFh7Sw/q95R1OHJWjY7PedH72O S0rnPxS8yz4HM2E8g2SIC+t+3TtlIsell59Pwv7NKOk4dP7kAA== X-Google-Smtp-Source: ABdhPJxDj4k7YX2oCl61kdYB377AyIPjFA3v2G+Klqf4LvN313NGjoWNc0g0JkZr14+FwstgtrerYe34BLMIQ1H7Aew= X-Received: by 2002:aca:f1c6:: with SMTP id p189mr3914260oih.18.1604527533408; Wed, 04 Nov 2020 14:05:33 -0800 (PST) MIME-Version: 1.0 References: <3af046e2-2647-4b9a-907e-47c2043ad60f@www.fastmail.com> In-Reply-To: <3af046e2-2647-4b9a-907e-47c2043ad60f@www.fastmail.com> Date: Wed, 4 Nov 2020 23:05:22 +0100 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000a943dd05b34f2d56" Subject: Re: [PHP-DEV] [RFC] Short-function syntax From: enunomaduro@gmail.com (Nuno Maduro) --000000000000a943dd05b34f2d56 Content-Type: text/plain; charset="UTF-8" Hey Larry, In my vision, this proposal is a good addition to PHP exactly as stated in this pull request (https://github.com/php/php-src/pull/6221): where only the "=> expr;" is introduced, and not the "fn". For visual consistency in the future of PHP functions/methods, I think it's important to differ "=> expr;" from "fn": - "=> expr;" means "arrow": syntax that defines functions/methods with one-line return expressions. - "fn" means "short": syntax that makes functions inherit scope. It's already in use by arrow short closures ( https://wiki.php.net/rfc/arrow_functions_v2 ). Therefore, from my understanding, your proposal would allow all the following things to be possible: ```php // arrow function function foo() => /** */; // arrow closure $foo = function () => /** */; // fn/short arrow closure ( already introduced in PHP 7.4 ) $foo = fn() => /** */; class Foo { // arrow method poublic function bar() => /** */; } ``` If this proposal keeps using the "function", and not the "fn", I don't see any conflict with my Proposal (multi-line short closures - https://github.com/php/php-src/pull/6246). Good luck with the RFC. - Nuno --000000000000a943dd05b34f2d56--