Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114539 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 50223 invoked from network); 20 May 2021 16:55:34 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 May 2021 16:55:34 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1F9901804D8 for ; Thu, 20 May 2021 10:05:35 -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_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 ; Thu, 20 May 2021 10:05:34 -0700 (PDT) Received: by mail-lj1-f179.google.com with SMTP id w7so7274239lji.6 for ; Thu, 20 May 2021 10:05:34 -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=iJ0ZnfB/hu4WB6hGHDcnQr70xOISYOvhkRISWaXWQzU=; b=YJD7f8Gr5JscgmwCEi+U+Wc2NuXJA5lRnW4zUMadCDDz70mUGSFRwNp7zsrnP/s0vG ZVLsLu7RjJ6vQcRkRYaBBFDcxPdv8QxaK8kyEgLa+7ZDrlGG9rV9UFgIkkx2YKZvYqLH 1a7tTsrUA5hh6apa5hmcuvqv5XFxthQOyKiGSdbaZDFHaaMlcOOUXNkg2gDByjh/7jaN xO94C0CtEU3FdiEi/jA29kRb7C15NAKGwMy/8eBSIpOGsPpo2sTyErl6Db85hVf1I7up QrxjDABqxc55a1RKKf4/THpeO5wmxTuHMebcioV74wv9nSLrM46Pod/3EVQXaL85cogY YszQ== 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=iJ0ZnfB/hu4WB6hGHDcnQr70xOISYOvhkRISWaXWQzU=; b=Z5CKHvzthvw1X3tDUA9G0h/Vz8N/HKZOfY8uVlCoUT/2sjIh0MvFp34MqaJeOsLkR7 6q2lTNenmHOWmjzDPRQhW1gX6BiLLNk5YxnNa2y+EJGVmTsn7MdIryqu30f6Jr/RMXEk c8FGsmCK5GqXKjZMDp+7lX5K3OXmqPydGuMekVGCS5iznDodo36zrGK2lFVgBEbxZu9q XSaF5H1+Mg8oI4sgyKTL0kXMd5PKlEPfNofr+TUaoAJmyS1LAebw62ZXkVkLZiOvyP60 QoDw+bj5pUNn8/6UiqGdQioF/0H6bNI68OPmyH72uJN6IdymIZ9/J8NYXV1beMBSQIFs 1kuA== X-Gm-Message-State: AOAM530D7pZ3mahxksjKIH6fhkTdedDwXMZIb+PNjhoUKzp2YNbLCMP5 3oC8Djg1NrAmOAsPAO4dhjOjkFLC35FcxKLV5xTPkJj3Z3DOfw== X-Google-Smtp-Source: ABdhPJwJCs1N866Ovc6QyLzR4uOzaQY4acawiKTLGjDbDUb1dQNSKKjGvGxUGzqsbzPr240SfwcBErFEBHwD0r/ldgE= X-Received: by 2002:a05:651c:50f:: with SMTP id o15mr3707324ljp.452.1621530330560; Thu, 20 May 2021 10:05:30 -0700 (PDT) MIME-Version: 1.0 References: <8c37bfe0-bf64-43ad-e553-165a4cab63b3@softsatsistemas.com.br> In-Reply-To: <8c37bfe0-bf64-43ad-e553-165a4cab63b3@softsatsistemas.com.br> Date: Thu, 20 May 2021 19:05:14 +0200 Message-ID: To: Luis Henrique Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000587dfc05c2c5f341" Subject: Re: [PHP-DEV] [RFC] First-class callable syntax From: nikita.ppv@gmail.com (Nikita Popov) --000000000000587dfc05c2c5f341 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 20, 2021 at 6:22 PM Luis Henrique wrote: > On 20/05/2021 12:55, Guilliam Xavier wrote: > > On Thu, May 20, 2021 at 5:12 PM Nikita Popov > wrote: > > > >> On Thu, May 20, 2021 at 4:16 PM Ond=C5=99ej Mirtes = wrote: > >> > >>> Hi, I=E2=80=99m confused by the syntax, when I read it, I think to my= self =E2=80=9CI > know > >>> this, this is just a method call=E2=80=A6 oh wait, it=E2=80=99s actua= lly a callable=E2=80=9D. > It > >>> really makes my head hurt. > >>> > >> > >> Yes, I can see how that could be confusing. The current syntax is > chosen to > >> be a subset of the partial function application proposal. However, I > would > >> also be happy with some other syntax that makes it clearer that this i= s > >> acquiring a callable and not performing a call. > >> > > > > Hi, several other syntaxes have been proposed to consideration in the P= FA > > thread, and I wouldn't want to start new bikeshedding here; is there a > > place that would be more appropriate to gather the possibilities (like = a > > kind of updatable list)? > > > > Thanks, > > > > I am much more into advanced features of PFA, but is this case why not > just use the & operator for "function reference" like C/C++? It is well > known and solves the ambiguity with method/function call. > > $fn =3D &$this->myFunc; > > $fn =3D &myFunc; > > $fn =3D &Foo::myFunc; > Unfortunately, this syntax is trivially ambiguous. "$fn =3D &$this->myFunc" is currently already interpreted as a reference assignment of the property $this->myFunc. I have updated https://wiki.php.net/rfc/first_class_callable_syntax#syntax_choice to discuss some of the obvious suggestions and why they don't work. Regards, Nikita --000000000000587dfc05c2c5f341--