Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112152 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 50828 invoked from network); 30 Oct 2020 22:25:27 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 Oct 2020 22:25:27 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BF74D1804C3 for ; Fri, 30 Oct 2020 14:44:56 -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_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-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.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 ; Fri, 30 Oct 2020 14:44:56 -0700 (PDT) Received: by mail-ot1-f47.google.com with SMTP id m22so6908860ots.4 for ; Fri, 30 Oct 2020 14:44:56 -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=W5oRjsTJO5jadnFeYIq+mf8bp3swv6crYPSK66DKeCM=; b=b54dhoQ2O3f3/uxRGYFNtUSgj06PmO5JDmF7b9mc5vZhQFAYhksKM7JV69dItP4lY5 JGvtBUIKW9+hl/22PzSKZMgTTmqV3ivmJd2qhxy6DbO5Mk6dCB0tHrS/H//kYzPIX0i/ RJ2h6fVchyAZyQd8XWUBZ/VZV1e4619edg7rXTpZYuIDugdvrXYIW2bL0dRVKSwwXOau m/Ge9hOd6MoKgmKWsOaEteOBX4IhTt/0cWF+PgaS6lChix03rWW26bmCZgWFwa6P5/7w tty9pOubhXkryul5Dkb0j3J71qIFM1WzqchoCt8qMWb+PkE6PdqQCB1zql7wpKUBrCfR Rpzw== 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=W5oRjsTJO5jadnFeYIq+mf8bp3swv6crYPSK66DKeCM=; b=rEitipKA1NBw54JwGAuOriBmbMIQLYHnUMUzwHlU2C2haBkpvbo1y/JtK2PvOt458u F6UhjoavF1pLM5nY8Attg+dHYtvr7GU0hKYNURzCDEqLYS6bIRWIUzwEIRs5ghsyt4r2 9H0hOl3elubGkRY5k1VhZY16PTzQSDlUr/iJefj5Tuo+Cr81wQmXiHAg/d7kkQ1wsAta Az+QCzObbp72lLxi5I4XI/PeZ+ZQaNVsUidNih5XP3BOv5qwN01PJwQMKrzZodmO1tju /uFxXQJHhVD5XSj5Af/UNTOkz/5kWKfPxnezLvTW7KsEp1qT47uLb/Go7oJT0XX8kpzy YzVg== X-Gm-Message-State: AOAM531I4kUN7L4pkq9cvYKkxGt3LpuGdsDL/v5Xcsa/wtt114+3wsuJ I+cb26zsfy24S/69XNejpGpjUGBzscmwFJKGyWg= X-Google-Smtp-Source: ABdhPJz2DHX5Kn5asQFzzALq/9RcmFuJNb3qEx9HTWPqlAZ9PQZEhLS80djFB4fMK/folNm/EmkQf+YFSn/gyQMuMbg= X-Received: by 2002:a9d:649:: with SMTP id 67mr3311486otn.233.1604094292352; Fri, 30 Oct 2020 14:44:52 -0700 (PDT) MIME-Version: 1.0 References: <446c9894-191f-e53b-4534-31c4e7b91d7b@gmail.com> <881e2335-5f81-0d79-6a17-06bc20f14223@gmx.net> <873361ff-02c8-b9df-9b7a-c9e89e25a880@gmx.net> <7F014A40-2D47-4DA6-8A38-59518218F9CA@stitcher.io> <9A58B811-37C4-46C8-A7A9-B558752362F3@stitcher.io> <9aa03cfc-a067-cc07-8dd9-50b95ae681ed@gmail.com> In-Reply-To: <9aa03cfc-a067-cc07-8dd9-50b95ae681ed@gmail.com> Date: Fri, 30 Oct 2020 22:44:41 +0100 Message-ID: To: Rowan Tommins Cc: PHP Internals Content-Type: multipart/alternative; boundary="0000000000007b6a4305b2ea4efa" Subject: Re: [PHP-DEV] RFC: Support for multi-line arrow functions From: benjamin.morel@gmail.com (Benjamin Morel) --0000000000007b6a4305b2ea4efa Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 30 Oct 2020 at 19:07, Rowan Tommins wrote= : > Just to be clear, the major gain here is not replacing the 10 characters > "function()" with the 7 characters "fn() =3D>", it is eliminating the lis= t > of captured variables. So you would get equally clean code with a > "capture all" syntax, such as: > > return $connection->transactional(function() use(*) { > > or Sara's suggestion from earlier today: > > return $connection->transactional(function() use($) { > Any of those would be a large improvement over the current situation I agree. That being said, for what it's worth, I've also proposed on the PR on GitHu= b an alternative syntax for a closure that takes no parameters and inherits the full scope: $connection->transactional({ // ... }); So yes, this would be a closure: $a =3D {}; I'm not sure if this would be considered (additionally, not as a replacement), but I thought it'd be worth mentioning, as it would offer an elegant solution for methods whose body is pretty much only a call to a method wrapping a closure. =E2=80=94 Benjamin --0000000000007b6a4305b2ea4efa--