Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112006 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 64897 invoked from network); 5 Oct 2020 14:25:11 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Oct 2020 14:25:11 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EAACA1804AA for ; Mon, 5 Oct 2020 06:38:20 -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.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from vie01a-dmta-pe06-3.mx.upcmail.net (vie01a-dmta-pe06-3.mx.upcmail.net [84.116.36.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 5 Oct 2020 06:38:20 -0700 (PDT) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe06.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1kPQh0-00051d-0L for internals@lists.php.net; Mon, 05 Oct 2020 15:38:18 +0200 Received: from mail02.home ([213.47.1.177]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id PQg1k0UBqIr7GPQg2kqtWN; Mon, 05 Oct 2020 15:37:18 +0200 X-Env-Mailfrom: markus@fischer.name X-Env-Rcptto: internals@lists.php.net X-SourceIP: 213.47.1.177 X-CNFS-Analysis: v=2.3 cv=QN4WuTDL c=1 sm=1 tr=0 a=/qIKuKYhvfCm6iufBMIR7Q==:117 a=/qIKuKYhvfCm6iufBMIR7Q==:17 a=IkcTkHD0fZMA:10 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=afefHYAZSVUA:10 a=2EALvoLjsrEA:10 a=ZZnuYtJkoWoA:10 a=Yxidusl-w8BXZGd0mYUA:9 a=QEXdDO2ut3YA:10 Received: from mail02.home ([192.168.1.14] helo=the-matrix-has-you.local) by mail02.home with esmtp (Exim 4.72) (envelope-from ) id 1kPQg0-0005Nc-EH for internals@lists.php.net; Mon, 05 Oct 2020 15:37:17 +0200 To: internals@lists.php.net References: <446c9894-191f-e53b-4534-31c4e7b91d7b@gmail.com> <881e2335-5f81-0d79-6a17-06bc20f14223@gmx.net> <7e50dba8b8749b9e32c803d7ded20fab84e21dc74ec9a55d8127e961bb036cd8@mahalux.com> <3711b2af-6768-5f76-8e4e-12748cf63eff@gmx.net> Message-ID: <9264909c-6610-6fd2-6463-638b9c5124ba@fischer.name> Date: Mon, 5 Oct 2020 15:37:16 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <3711b2af-6768-5f76-8e4e-12748cf63eff@gmx.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam_report: Spam detection software, running on the system "scanner01.home", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On 05.10.20 12:24, Andreas Leathley wrote: > On 05.10.20 12:08, Lynn wrote: >> How should php deal with the scenario where you want to `use` everything >> and have one variable by reference? >> >> ``` >> function () use (*, &$butNotThisOne) {}; >> ``` > > The easiest would be to only allow "use (*)" with no references or > additional syntax. "use (*)" would only copy all local variables into > the closure, no references. Personally I have never used references with > "use", I think it is much more niche compared to the regular copying, > and there is still the explicit (current) syntax to do references. [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 NICE_REPLY_A Looks like a legit reply (A) X-CMAE-Envelope: MS4wfLhns9QL7gb7q0kUJrd292ll3tpwHEE0KrMp+EroNrITtiI+z8l9/RXuhAPRxEi4BwJI369UULj3Om9nhbLx7qqUSLuIZUHr4/NATUsuTCNzB9wq3sbo SqQhtNZIEVq5fsyPD619AZ1nWkZ4ix0JpIWA0ttrPyBDnj0uagrg1fAT Subject: Re: [PHP-DEV] RFC: Support for multi-line arrow functions From: markus@fischer.name (Markus Fischer) On 05.10.20 12:24, Andreas Leathley wrote: > On 05.10.20 12:08, Lynn wrote: >> How should php deal with the scenario where you want to `use` everything >> and have one variable by reference? >> >> ``` >> function () use (*, &$butNotThisOne) {}; >> ``` > > The easiest would be to only allow "use (*)" with no references or > additional syntax. "use (*)" would only copy all local variables into > the closure, no references. Personally I have never used references with > "use", I think it is much more niche compared to the regular copying, > and there is still the explicit (current) syntax to do references. FTR, short arrow function implicitly only support "by value" bindings, I just checked the docs. I do use by ref with closures btw. - Markus