Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113827 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 21983 invoked from network); 28 Mar 2021 12:06:59 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Mar 2021 12:06:59 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 765F51804B7 for ; Sun, 28 Mar 2021 05:03:42 -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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mx.kolabnow.com (mx.kolabnow.com [95.128.36.40]) (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 ; Sun, 28 Mar 2021 05:03:41 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by ext-mx-out002.mykolab.com (Postfix) with ESMTP id 7A3BDC84 for ; Sun, 28 Mar 2021 14:03:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:content-language:content-type :content-type:in-reply-to:mime-version:date:date:message-id:from :from:references:subject:subject:received:received:received; s= dkim20160331; t=1616933018; x=1618747419; bh=pufSc6a3bHpaYzC5U5Q b/ZBOeJp0kvMHb232v2zR5+Y=; b=QzbtuuzdezJmH/UegpiYBUr7wDNsDrJwJzF QdjtM869sj7C3I0AnJB6qZ/0l0lbxp7HvP/xWoT2DAGItjkqdETpUhT3V/b/bSGh A1+p4dBy0cy7QwN5fyMebxNqLhSiYAzoocthkhojYHxBAjCafXl36whQWuLct3gL XLGHd1YBbf0Bg+oWcYVUwotWF0eg0+ee0cY3vrS3aGydrymrLeJi8/iZDCKzT1vV DDLc51hjKOJzVTz9iIxVVU5l7C1QBljHjcpDMBXBPPFeYYmdNFAZonVzNWrzuGDX QSTzadLG9Z3oNX/ejZBcYew2WGOmeXCPmjmzg2qovlA2YNsUeBfKX+43Rw6N/k21 D4lKMaZmLimxhJ0dkwIiXnkD9Mean4P9UM0YARcbOcAQky9EmNiEk8ipxwJJvLmE TCfbWGRycMwB/2qAEp3sV7QrFHluaErAwrLCQFQdK6BjHTC5khoL/ByLOnLj1fwl 4ATL4J/xjhFIrUXRNUzyvqUkBftVADUvyMVbooUHfbE9/eoXvz1jJKmrlwUjNMfZ WNlgk3PrXFr+EjJZsT/Au/m4SNIV0Sz3/CbGaNj1Kn1vnfc88tSs5Uwn/8DzCihc 4/7KVpQq+exiHJC+bzlr608RzVKJMt78DdYvaeZCrQGDwGUVK31wJHKhJd2Oi+MD weVsvv7U= X-Virus-Scanned: amavisd-new at mykolab.com Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out002.mykolab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cxz0s0YcJzMT for ; Sun, 28 Mar 2021 14:03:38 +0200 (CEST) Received: from int-mx001.mykolab.com (unknown [10.9.13.1]) by ext-mx-out002.mykolab.com (Postfix) with ESMTPS id 7265345A for ; Sun, 28 Mar 2021 14:03:38 +0200 (CEST) Received: from ext-subm002.mykolab.com (unknown [10.9.6.2]) by int-mx001.mykolab.com (Postfix) with ESMTPS id C12D616E for ; Sun, 28 Mar 2021 14:03:37 +0200 (CEST) To: internals@lists.php.net References: <88c9eb5f-f80c-4869-b7f8-1b58b9e2eaa3@www.fastmail.com> Message-ID: Date: Sun, 28 Mar 2021 14:03:35 +0200 MIME-Version: 1.0 In-Reply-To: <88c9eb5f-f80c-4869-b7f8-1b58b9e2eaa3@www.fastmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Auto-capture multi-line closures and short functions take 2 From: alec@alec.pl (Aleksander Machniak) On 24.03.2021 17:19, Larry Garfield wrote: > 1) The updated short-functions RFC: https://wiki.php.net/rfc/short-functions > 2) A new RFC, code by Nuno, for auto-capturing multi-statement closures: https://wiki.php.net/rfc/auto-capture-closure I'm not sure just the keyword (`fn`) should indicate the change in variables scope handling (auto-capturing). Note that in Javascript it is a new syntax not just the keyword. Looks like a counter-proposal could be this syntax: $foo = function($a, $b) => { $val = $a * $b; return $val * c; } then whether it is `fn` or `function` keyword does not really matter. Here it is `=>` that indicates the auto-capturing in the block on the right side. I don't know. Another approach might be something that makes mind to think this is something different than a function. A completely new keyword that makes the code block to auto-capture. E.g. `procedure` or `macro`. -- Aleksander Machniak Kolab Groupware Developer [https://kolab.org] Roundcube Webmail Developer [https://roundcube.net] ---------------------------------------------------- PGP: 19359DC1 # Blog: https://kolabian.wordpress.com