Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:114164
Return-Path: <maxsem.wiki@gmail.com>
Delivered-To: mailing list internals@lists.php.net
Received: (qmail 55256 invoked from network); 25 Apr 2021 21:03:56 -0000
Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5)
  by pb1.pair.com with SMTP; 25 Apr 2021 21:03:56 -0000
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id D6C401804DB
	for <internals@lists.php.net>; Sun, 25 Apr 2021 14:07:47 -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_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,
	SPF_PASS autolearn=no autolearn_force=no version=3.4.2
X-Spam-Virus: No
X-Envelope-From: <maxsem.wiki@gmail.com>
Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42])
	(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 <internals@lists.php.net>; Sun, 25 Apr 2021 14:07:47 -0700 (PDT)
Received: by mail-ej1-f42.google.com with SMTP id l4so81383233ejc.10
        for <internals@lists.php.net>; Sun, 25 Apr 2021 14:07:47 -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=jPVvNsOvS0Y40uhiyzgxKnrGawB+mcH7MPgAMupohWg=;
        b=uR8xonPmN3bpo4f0goJBDaWM/iPlfT/tpIh/FFjwQTJhNygJD/p45WyUEny5dhotQN
         +Uig1bUg7xKcj2fj/ND85ZkLro9z5tYILzENs/LlqTqaISgGMgfvomO0OhOHxy+Cj6QR
         xvBFrLI8MInFJXEp3FtEI+BU5qz4pC8pTzLfVt4Kp4380YnarSolewGwgkF58N8JKHjq
         a7QpZ5OnYkcTlVTgwOxr1ZJJjuN3zI4ncqASvKrEOJoNWnA5kCpoK2PKKF2PbMSt/oDc
         yQ7ENMiV4hNgBw89lhjEXTz6uKrWdbx21bw6UiwuGx8dc5Ejhkg12tLqxcNQALLIlW5V
         RMQg==
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=jPVvNsOvS0Y40uhiyzgxKnrGawB+mcH7MPgAMupohWg=;
        b=sqEf2GjcF0DuMgAeBSvzMqcgGDYoukycyiYhjqY1JswTZnkAqRd4dxvl5iQH/BX+Fe
         Brb3ASIcKS9C/H6WZhLPWqJ/KbvRY/VLn8MiXh2a49LCyiSCqOATxsKsuNff3GnQrHZ3
         apLDvuG4m7JBx+jRHUcavmHCywqMK75gRecTw5zde97o522xbhsd6hrjMu/dm5vnLyUE
         4cj504akCMUqTDTTIoAmcaL9KBc/XFHGRylnAA+B0rT5NrTt/bud6227Z1amEAbxffvC
         PSzM61FOx47ebBsmz0JviYK0yGOJ/vbwQLkYz4V2xjIZl3YEDcQBy3Ch3+4aE/Yd8ZNz
         K5XA==
X-Gm-Message-State: AOAM530wilmXd0t/rm58jGFURHm/RofRxdaxJA//AKlJmp71NCKBsSYe
	1VTUqr+7fFSdXDZ9kVU8nvgMLEJE8MoQHw7I0yk=
X-Google-Smtp-Source: ABdhPJzb8a4lMGO2LLoMKj7ij+cQPII7B9OnGk75AEwg0/bubMT+9WrZRqlc/wBfznV8PfkYAL954kQ4v8Fz8zRMRj0=
X-Received: by 2002:a17:906:d7b1:: with SMTP id pk17mr7633690ejb.294.1619384862981;
 Sun, 25 Apr 2021 14:07:42 -0700 (PDT)
MIME-Version: 1.0
References: <f3d20496-c560-42b7-9a0d-8672b3cafa7d@www.fastmail.com> <CAJpLVh3Wr9Gr54HU8g58Ea1OfMt78dL1_EUa8z3Wpy2Q84Xrug@mail.gmail.com>
In-Reply-To: <CAJpLVh3Wr9Gr54HU8g58Ea1OfMt78dL1_EUa8z3Wpy2Q84Xrug@mail.gmail.com>
Date: Mon, 26 Apr 2021 00:07:27 +0300
Message-ID: <CAGgaK7JxWAG7t5zy83y+X7iXSWhWHbz8ny70En1Rs_WXodsOpA@mail.gmail.com>
To: =?UTF-8?Q?Olle_H=C3=A4rstedt?= <olleharstedt@gmail.com>
Cc: Larry Garfield <larry@garfieldtech.com>, php internals <internals@lists.php.net>
Content-Type: multipart/alternative; boundary="00000000000083428805c0d26bf4"
Subject: Re: [PHP-DEV] [RFC] Partial function application
From: maxsem.wiki@gmail.com (Max Semenik)

--00000000000083428805c0d26bf4
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Sun, Apr 25, 2021 at 10:26 PM Larry Garfield <larry@garfieldtech.com>
wrote:

> https://wiki.php.net/rfc/partial_function_application


 Amazing, I've wanted this for so long! Have you considered extending this
syntax to OOP, e.g. $obj->method(?) or SomeClass::staticMethod(?)?

On Sun, Apr 25, 2021 at 10:51 PM Olle H=C3=A4rstedt <olleharstedt@gmail.com=
>
wrote:

> Nice. :) Are there any other motivating use-cases besides pipe
> operator (that are relevant for web dev)?


One reason I'm personally excited about this proposal is that it would
allow static analysis in more cases, e.g.

$param =3D 'fooBar'; // What's this string? A user name? Elon Musk's favori=
te
color? Text of US Constitution?

somefunc($param);

function somefunc($cb) {
    $cb(123, 'meh'); // What parameter types does this accept?
}

Allowing syntax like $param =3D fooBar(?, ?); would indicate clearly what
this variable receives. Analysis tools would then be able to check if such
a function exists and whether it would receive parameters of expected types=
.

--=20
Best regards,
Max Semenik

--00000000000083428805c0d26bf4--