Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114544 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 68486 invoked from network); 20 May 2021 18:24:05 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 May 2021 18:24:05 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D8A4E1804B0 for ; Thu, 20 May 2021 11:34:09 -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=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,SPF_NONE,URIBL_SBL,URIBL_SBL_A 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 ; Thu, 20 May 2021 11:34:08 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by ext-mx-out002.mykolab.com (Postfix) with ESMTP id 6356ABEB for ; Thu, 20 May 2021 20:34:07 +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=1621535646; x=1623350047; bh=C99va0LFfKItbX6jpUf mLU3a7BxwbIuaAQufbaaxK6g=; b=fObZU81iD2h8UVTPv4YPWcGUBNvZGqAEHwM PxMNtf8xzuxqJFZQHunksodZq364YbhJiLpbYr9gOwBdyYGCOaXn/Tey/0rFPvtQ eOeOvRJtOrvKijXLmU1AQwVVTXVErvBEdEqAMRfLhnxGvcOkJdCv09Gwa5KhYDts I+4jbzm137i+X8AQSvFDuNtgxExZnLoOos8RjzTsUio8ANPw5pqa/koAXxShK2LV aKeC3VMD91rf8e7Cw9CuczTrZCUVb+5QDYdYqRQTjg8zt3GAmiiSKRNuMStESPrX PM3cRxCxrg0hXiO5gVlAmrgtCkr1OKnpsMHi9QdXYxngEz6KUK4lgMaoM4R56vWB a9kXY0cKmX0ZTKXTgm55bBNwuUTZsTNL8m9Lq+7LoP7MrcKd9gYSu/jUulpFoiTt 745lQjIm5mLZSCWmS0G4syiJKTa0vlwhGCx5qOpHaV4vXjSfH/sMi2BDEcBYOZWq OA/homf6AISzmshz7mXFPR+LkoAiK4EKmIwNw+2Mn/9Y4HC3x/EBUhrEEAbBJ+P9 nIYdbZHtGxpWNGiVfhLPBW0zonZwIfJ2QmL9w06pQG6yGOyLwReUALNY/wA0kaWl nRdM8MKLEEDWj5Qx837NLlXb1ei55rP8J3uCvKD6T6rCE7s/NpNIqPjIleO4xC0v wHl1Xrt4= 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 qtAzG7sxcUWD for ; Thu, 20 May 2021 20:34:06 +0200 (CEST) Received: from int-mx003.mykolab.com (unknown [10.9.13.3]) by ext-mx-out002.mykolab.com (Postfix) with ESMTPS id 87D8F88D for ; Thu, 20 May 2021 20:34:06 +0200 (CEST) Received: from ext-subm001.mykolab.com (unknown [10.9.6.1]) by int-mx003.mykolab.com (Postfix) with ESMTPS id D6F604549 for ; Thu, 20 May 2021 20:34:05 +0200 (CEST) To: internals@lists.php.net References: <8c37bfe0-bf64-43ad-e553-165a4cab63b3@softsatsistemas.com.br> Message-ID: <983311a1-d94c-0851-74f5-f9286de4f0af@alec.pl> Date: Thu, 20 May 2021 20:34:03 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] First-class callable syntax From: alec@alec.pl (Aleksander Machniak) On 20.05.2021 19:05, Nikita Popov wrote: >> $fn = &Foo::myFunc; >> > Unfortunately, this syntax is trivially ambiguous. "$fn = &$this->myFunc" > is currently already interpreted as a reference assignment of the property > $this->myFunc. could that be just fn(sth)? I mean without the => part. $fn = fn($this->myFunc); $fn = fn(myFunc); $fn = fn(Foo::myFunc); and then something like this $partial = fn(Foo::myFunc)[?, 42]; or $partial = fn(Foo::myFunc, ?, 42); My earlier idea was that actually cloning a callable could convert it to a Closure, but I'm not sure now: $fn = clone $this->myFunc; or is this a heresy? ;) -- Aleksander Machniak Kolab Groupware Developer [https://kolab.org] Roundcube Webmail Developer [https://roundcube.net] ---------------------------------------------------- PGP: 19359DC1 # Blog: https://kolabian.wordpress.com