Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112098 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 79553 invoked from network); 21 Oct 2020 23:00:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 21 Oct 2020 23:00:40 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EC0CC180508 for ; Wed, 21 Oct 2020 15:17:55 -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, 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-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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, 21 Oct 2020 15:17:55 -0700 (PDT) Received: by mail-wr1-f44.google.com with SMTP id x7so4931198wrl.3 for ; Wed, 21 Oct 2020 15:17:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=S5dyRNBGNoznCmyN4Xc0ZViG+pVbPj33h9ksvHz0ypk=; b=PAEcslXSpNsriUkVIy5kzI13d+eqbZipE76jr9WRj0lGw1wAPUWEOefNCCA/1/vnVu t8S3D8UbxrDIImfZH1e4Q0b3JSuXUdojNY6MiDQtl0utwmc59QZi/F/KHcKofDCAeFRW qD8vjmKC9gQod6KN9rtgXsNMbamRkUQGVGFJgl4nELe+1Uv+8I05B76F0LsIkOIWLeE3 Tw8IXZayPF+/FTPxRleaXEbF8zMOGzsswMH1lWzAZzDZbKAh9nUOGiql0jJl/i2TjyeE uLKU+eZw8AkmpnJiXAaALQA/BEFVOtFPz/s+WURkLNWQLRvehlSwpxSuGllNf7u4VE6r o/rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=S5dyRNBGNoznCmyN4Xc0ZViG+pVbPj33h9ksvHz0ypk=; b=fii7VpslzxrGgitPn9fQ8W8SMF2OlnQ394VDOkzSpLKJs3XUe1ULB+caNv6LA8lBRa kck3c00Zmm/f+i4oMrMu792Z6fCaMEZAdxAcE98xUM0MuatSW57LQAD9/bVENe1sXsh2 BUtvyCiEgvYWk6QocaPdU9caAYfltpNlYr5tM2RilXwuxil20rMeJt/7McUmYRB7zmTG UzdR+ODnw+Yvn19VUNUgcazxGZC+jNOLwKTLdgMRtO0+FAWvhcPoe31F3qskwEbDgB1Q 4Iy3XZvUtNpSNnnxOF9W6NVIG5AA6LJ6N8kSozr31SNOqQV3W9dy3CT7qsjwLCVAx44B NobQ== X-Gm-Message-State: AOAM530vvZXM9jarw468q9z6icSjAMo+iAORqcyF3rlbHLi72U8hS0j+ E61Mkt1Ji8s0qjIM0XqvVb+O53kwHDg= X-Google-Smtp-Source: ABdhPJy0BtLugoYj1klDF9u63NxikwyPCH7PJVTRSaO1i5gDcnQJoQ/fu9CPduC6xQUWlJplp3KsEw== X-Received: by 2002:adf:9dd1:: with SMTP id q17mr6949165wre.317.1603318670812; Wed, 21 Oct 2020 15:17:50 -0700 (PDT) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id h7sm6040694wrt.45.2020.10.21.15.17.49 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Oct 2020 15:17:50 -0700 (PDT) To: internals@lists.php.net References: <812317f5-dd87-497b-b483-bc3b7f3c2e7d@www.fastmail.com> Message-ID: Date: Wed, 21 Oct 2020 23:17:49 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <812317f5-dd87-497b-b483-bc3b7f3c2e7d@www.fastmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] [RFC] Short-function syntax From: rowan.collins@gmail.com (Rowan Tommins) On 21/10/2020 21:53, Larry Garfield wrote: >> A while back, Nikita mentioned that it should now be easy to offer an >> abbreviated syntax for functions that are just a single expression. I >> decided to take a crack at it and it turns out he was right. I thus >> offer this RFC: >> >> https://wiki.php.net/rfc/short-functions I like it. It fits nicely with my mental model of arrow functions as being special syntax for "functionising" a single expression. It may appeal less to people who see arrow functions as "the better way to write closures", and are hoping to extend them with full procedural bodies. > There's been some discussion on the PR that I'm looping back here for completeness, mainly about using "function" vs "fn" for short named functions. You could list that under Open Issues on the RFC. It occurred to me recently that maybe we could make "function" and "fn" synonyms everywhere, i.e. make both "$double = function($x) => $x *2;" and "$double = fn($x) use ($x) { return $x *2; };" valid. I'm not sure if that's desirable, or even if there's a reason it can't be done, but it would mean you don't have to make a decision on this RFC... Regards, -- Rowan Tommins (né Collins) [IMSoP]