Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108490 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 71866 invoked from network); 11 Feb 2020 19:07:18 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Feb 2020 19:07:18 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 097E0180533 for ; Tue, 11 Feb 2020 09:21:15 -0800 (PST) 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.6 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, SUBJ_ALL_CAPS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (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 ; Tue, 11 Feb 2020 09:21:14 -0800 (PST) Received: by mail-lj1-f172.google.com with SMTP id q8so12443674ljj.11 for ; Tue, 11 Feb 2020 09:21:14 -0800 (PST) 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=yLsU/ruugqbcC9a2DCceJABYV+d5SRCCHoAu3glzEZI=; b=PcFao4kyqGTbd7Zs44yJ0dpWN+4Z3V61/RiWD46sYi36rSpzyUS8X0on+cTjFvaI1A 773DdYuWiyJGoBJf9FTF2gX34fBI3Pak44QrpdcW2+BHt3/y8DyVh+V/6I9ZKMWHBaYC 2VOkW79uc1j+TRlyrG57BvKtpOt1wIPsCgxcmM31YWWApLdYC0mWvO4veZ/61dRG3gMs eP5yTEBimNkQbHTuNOyiXwpAvngL2xi/VADEoTDNlSGzScxkT4ZMS9SMJqT3f/EwhOVV PWXntF8YPSy5dn9EDGj4hI597UAGncdqZUHYAVgPl9bSfZDQLx5K26mp2jYYq4we4pFe c3Gw== 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=yLsU/ruugqbcC9a2DCceJABYV+d5SRCCHoAu3glzEZI=; b=LRYTQtrHJL4/4PfqZdHE8m66sux81vodlkbSWmJjvogQYXYMlALOHqNVxZm9tA8vnL jJNFOl4/VnytEisjvWGiNwG05QteMeBzMRIDwL8ZmZtw7aVZZwKaX9lVLDMBhkxD0UPm inVY4U07VWSnA0vAeOY68cIfdrPjROv5b0r/AJZH3lioLLKiOXJcIojHgSHfSdypWsU/ Ej171l+FSAycCCcejnpdyg5QzF3oPs9nhpxd6vH3uo9IuESc9vhVI6Ijn5XbipDfmu/n 8Oo1VDcpfpvXbQNtrII106J9JskidgAqrHzAmtX+L8PhHn1ra2VWpwIJdVckX3R2Jk+J XXRA== X-Gm-Message-State: APjAAAUDyQp4gNhLJWz90I2omFUrKED9WIR0uWgCH68lrG1ROE10muhV 4zLadlxehgIQ2od8wXkW/37Ce1/HtAbElFgQXmM= X-Google-Smtp-Source: APXvYqzTD9krfq+OExjT/qZ1GN0JKiMoE2sdaWFtmb8xhR3lE8uUax+j8yZeE/NduKPESsSrT15JAL/Siw4hapbNOAg= X-Received: by 2002:a05:651c:102c:: with SMTP id w12mr4875108ljm.53.1581441672362; Tue, 11 Feb 2020 09:21:12 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 11 Feb 2020 18:21:01 +0100 Message-ID: To: Dan Ackroyd Cc: Nicolas Grekas , Diogo Galvao , PHP Internals List , Nikita Popov Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] From: manuelcanga@gmail.com (Manuel Canga) On Tue, 11 Feb 2020 at 17:49, Dan Ackroyd wrote: > > Nicolas Grekas wrote: > > I wish this would return a Closure instead, making $foo::function the > > equivalent of Closure::fromCallable($foo). > > I didn't include the following in that RFC, because I thought it would > be too controversial, but I think it's worth considering a new syntax > for this. > > Given the code: > > function foo(); > class Zoq { > public function Fot() {} > public static function Pik() {} > } > $obj = new Zoq(); > > > Then these: > > $(foo); > $($obj, Fot); > $(Zoq, Fot); > > Would be equivalent to: > > Closure::fromCallable('foo'); > Closure::fromCallable([$obj, 'Fot']); > Closure::fromCallable('Zoq::Fot'); or Closure::fromCallable(['Zoq', 'Fot']); > > Or similar. > > The justification for having a dedicated syntax is that I think > readability is quite important in code, and it's reasonably common for > me to have quite long lists of 'callables'. > > [Bar::class, foo1::function], > [Bar::class, foo2::function], > [Bar::class, foo3::function], > [Bar::class, foo4::function] > > vs > > $(Bar, foo1), > $(Bar, foo2), > $(Bar, foo3), > $(Bar, foo4) > > The latter is far easier to read for me. > > Nikita Popov wrote: > > This would circumvent all the issues outlined in > > https://wiki.php.net/rfc/consistent_callables. > > Probably there would still be some issues with some of the weird stuff > happening internally in SPL related code where the deep horrors > rest...but we can leave them alone...and they might not wake. > > cheers > Dan > Ack Hi, Dan, I like it, although syntax reminds me to JQuery syntax. Thanks