Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119405 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 77051 invoked from network); 23 Jan 2023 18:22:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Jan 2023 18:22:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 73C34180507 for ; Mon, 23 Jan 2023 10:22:54 -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=-2.1 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, T_SCC_BODY_TEXT_LINE 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-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 23 Jan 2023 10:22:54 -0800 (PST) Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-5063029246dso16383757b3.6 for ; Mon, 23 Jan 2023 10:22:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=LcNJb6yhKanQjCMrxkGtwv4kiCHttXGiZOv65obMY10=; b=jxq9qof5IgFUny2kcjgjwnP1+folNE9V1EA1y6vfAl7tavOdjh+RoEc1zH2fZo9kFr G117lQXn1nrQ9n5LyoFPoTqtI/tm5OcVlDGjCn5fxPXk7LuXl9BpjdQHbIc/0/CN2dPQ Mps+5D/6yOyzJNwFzn7uUkMEOJts7qKzTxvHZEzok23mXHm6YcEJ8HcVg/Wn85SwJ7C4 +N7gHlbq1vJpYvG2kcG1BQ3d76hP5QzfaJehiVJw55S3tihbrQAiLy2FaYg0LGLl/0RN 8ksZLu0JlrdlKSwskdBBqmbv+4TRa5gzVC4PrUu0F/uTEr1vBFeD/vzlQrMcee0Rvf2c qVkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LcNJb6yhKanQjCMrxkGtwv4kiCHttXGiZOv65obMY10=; b=vsIPzwDgUqYbIl0bKpBjZ4T2OobSNbksM8OJ7uBnbtDXHhkRcymPbYVQKyFcfDpStp I5+8hsR0cw9Dhbti82H8rdXhDp6hmaCSiJI6g5BhutKy6GHnrFrsba1adSAMtnD2n/wZ pqL2zk9Dl03mcToUhHUwB3XCcKvp4wBdkXmHh3KGw7cUxbetuqw8s56Ve2YZUB0Ksyzi Vcopn7gLm2Zv+VjAlxylAsLuORL6Fj1Gt5XkiEJXMrUKqqaVgRKq035ttwu3jNP0CqqU ytGyYGlhVDBPEildZyeUsFQYgqNKG1JppNs1Aq1ArwVB9JX8t4fZ45B4PcA3IJaSL9/0 SqCg== X-Gm-Message-State: AFqh2kph4TdDX3J1Kr8+eIWu/+Z6Y81VXV9z+3t0+pTfI23SdGP55IA1 R1MMWPW0ZFGpENg6vi1g1Dmq8FPfZa9ziZ8rYm8= X-Google-Smtp-Source: AMrXdXux/ji+4IPAsfMawuQ+44KhRkl0ypgUQowfnk5gftxRDKXQszo8cS/HlJxz5Ma26WGHRyt1hsmlIN4PRI4VuG4= X-Received: by 2002:a81:990:0:b0:4f8:621f:a2fb with SMTP id 138-20020a810990000000b004f8621fa2fbmr2207816ywj.360.1674498173270; Mon, 23 Jan 2023 10:22:53 -0800 (PST) MIME-Version: 1.0 References: <8f530a4a-bf48-4259-877e-16ebf8082936@app.fastmail.com> <88a59c46-9261-43f1-874d-ffc2f9caff32@app.fastmail.com> <99bc38dc-3d62-4a1e-a99c-e5daab3d779f@app.fastmail.com> In-Reply-To: Date: Mon, 23 Jan 2023 19:22:43 +0100 Message-ID: To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically From: landers.robert@gmail.com (Robert Landers) On Mon, Jan 23, 2023 at 6:31 PM Larry Garfield wro= te: > > On Mon, Jan 23, 2023, at 10:53 AM, Ollie Read wrote: > > There's definitely similarity, but I would say it sits somewhere > > between the two. Rather than reference a partial method call, or create > > a closure for a method, you're delaying a method call. Or rather, > > referencing a method. We have the ::class pseudo property, so I see > > this like an equivalent, but for methods. > > So what you're really looking for is a shorter way to write this: > > foo(fn(Str $s) =3D> $s->beep()); > > Now you're definitely in the realm of PFA, pipes, and that kind of functi= onality. And, sadly, Internals has shown a great deal of resistance to tha= t kind of functionality. I have a user-space implementation of pipes that = includes utilities to do something similar[1], but most functional language= s I know also don't have a really strong native way to "turn around" a call= like that. > > I'd love a solution for that, but so far it has proven both elusive and c= ontroversial. > > --Larry Garfield > > [1] https://github.com/Crell/fp/blob/master/src/object.php#L28 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > Speaking of partial application, it'd be amazing if it were available with the current closure syntax: $func =3D fn($x, $y, $z) =3D> echo $x + $y + $z; $plus1 =3D $func(..., 1); $plus2n1 =3D $func(2, 1, ...); $a =3D $plus1(1, 2); $b =3D $plus2n1(5); I spent a few days last summer trying this out, but couldn't get the grammar parser to accept it. I think I have a local branch if someone would be willing to work on it with me. At least point me in the right direction. I don't have much free time these days, but it is certainly doable. Robert Landers Software Engineer Utrecht NL