Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:119410
Return-Path: <larry@garfieldtech.com>
Delivered-To: mailing list internals@lists.php.net
Received: (qmail 98357 invoked from network); 23 Jan 2023 23:03:32 -0000
Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5)
  by pb1.pair.com with SMTP; 23 Jan 2023 23:03:32 -0000
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id F06521804F2
	for <internals@lists.php.net>; Mon, 23 Jan 2023 15:03:31 -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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,
	RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE,
	T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2
X-Spam-ASN: AS19151 66.111.4.0/24
X-Spam-Virus: No
X-Envelope-From: <larry@garfieldtech.com>
Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26])
	(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 <internals@lists.php.net>; Mon, 23 Jan 2023 15:03:31 -0800 (PST)
Received: from compute4.internal (compute4.nyi.internal [10.202.2.44])
	by mailout.nyi.internal (Postfix) with ESMTP id 885F55C013F
	for <internals@lists.php.net>; Mon, 23 Jan 2023 18:03:29 -0500 (EST)
Received: from imap50 ([10.202.2.100])
  by compute4.internal (MEProxy); Mon, 23 Jan 2023 18:03:29 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
	garfieldtech.com; h=cc:content-type:date:date:from:from
	:in-reply-to:in-reply-to:message-id:mime-version:references
	:reply-to:sender:subject:subject:to:to; s=fm3; t=1674515009; x=
	1674601409; bh=l3rnL24+xUW1Vq0b4GmAECUPayQ/k+ME+T8tepquf8Y=; b=N
	AdrBVASGUvjTjcp7p1OlvwMrD/xcMZWAPoqI05Fjrk5dLLWf4FqlqubA4zKgyPHo
	RACKudIjrkWdIlyQBOSlZYQ6sR7GBZjZAHTUUSy+wQLlIISFQvastAJaL5z8p9L3
	RqJtQEL32gqij5zFwFtTH/XFEL02oFIUuEq2Rq9KsXJc27mtuNEYDeOmF1fs6da+
	cPZrxSm+c4tYvYqefEe9BHVWZ0PToLXn62VPx4S2O5D4QltEkFQeLrISsffsRB6z
	C+HGTVL+USWc2Qq5OiC/mQqYEjxw6t/L8cjgK7Gdl5t6pPVvf3382t2AIDEyir1t
	dZ0AB00ZFd7kkn7wapeFw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
	messagingengine.com; h=cc:content-type:date:date:feedback-id
	:feedback-id:from:from:in-reply-to:in-reply-to:message-id
	:mime-version:references:reply-to:sender:subject:subject:to:to
	:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=
	fm3; t=1674515009; x=1674601409; bh=l3rnL24+xUW1Vq0b4GmAECUPayQ/
	k+ME+T8tepquf8Y=; b=VWzVWqKYl6wtWQ5cpPZGnz6Ih5glKZUxnyOEJ2NTnwOC
	zodS5XACelxXjlbQQDc24iOQ7J2QZkLYUSRwhwcByObl223oIc/4Mc4yZO4vA3/J
	TCT6dEuE6qXd3PhFfBV/YRbdt2HWfzZKFGmaLHgMjOf+eosAhVJ5EKu/liFVdZk7
	KWkDw6NuYluxPiKWyJx/46dePNyMyDZ7Lf8buTpa96IN/WGyoznvDvv/XPYDWQOG
	3CXYqe6c+Coz5h3QCq8wYoUCGVf5i8sGP2d9inE4MhPzAActQxcP7kPx/s0WhO6m
	27eYJ8ysmJuFI8rWQekGctE4gikuzuP1I7C/XB24Uw==
X-ME-Sender: <xms:QRLPYxkjNaAslZbuVfUrDkiVwSbsHVGDWJwaIkCQJaso6GV10mOodg>
    <xme:QRLPY82DKkWY0c8g-Z2_BBy4cyA9ZI0p4k8dQ087Esx0WSnxI7XAFjjHJP96UAP5U
    ih_5H_Fze4mjQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudduledgtdeiucetufdoteggodetrfdotf
    fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
    uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
    cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr
    rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh
    hmqeenucggtffrrghtthgvrhhnpeeglefgkeduiedvvdetffeujefftdfhjeeiveehgfff
    keduveektddvledvvdfffeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh
    grihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh
X-ME-Proxy: <xmx:QRLPY3qk4OOtztq42kT62QybGvhkRWECNRjiyILTfB9qUGmw7s0btg>
    <xmx:QRLPYxkQx4vFAqeVb2PXcLFx7uRpFhJb2lUxMLfj0P7qFIVJwHxlbw>
    <xmx:QRLPY_0UiB3en6J_vdFB2XQS9z7FZLNRNo2PDt99k9fGlGiH_vjEvA>
    <xmx:QRLPY20DqpX8jYBXAWuENotyei9bL71QQK3d-n25EeTCwzvIjoaodw>
Feedback-ID: i8414410d:Fastmail
Received: by mailuser.nyi.internal (Postfix, from userid 501)
	id 35CB81700089; Mon, 23 Jan 2023 18:03:29 -0500 (EST)
X-Mailer: MessagingEngine.com Webmail Interface
User-Agent: Cyrus-JMAP/3.9.0-alpha0-85-gd6d859e0cf-fm-20230116.001-gd6d859e0
Mime-Version: 1.0
Message-ID: <f9df091f-15c0-4469-b657-b96e4321e763@app.fastmail.com>
In-Reply-To: 
 <CA+kxMuRTFvMwCnYbs_CWszESULRENKu-ndK3U+b5tMX96HmJ=w@mail.gmail.com>
References: <8f530a4a-bf48-4259-877e-16ebf8082936@app.fastmail.com>
 <CA+kxMuQWYqE-LMuQPU66xK1DAZNOdV_-A677oSKyPzhJeEZFpQ@mail.gmail.com>
 <9c97b0b1-e17e-4eec-8cf5-fad86aca2da6@app.fastmail.com>
 <CA+kxMuRTFvMwCnYbs_CWszESULRENKu-ndK3U+b5tMX96HmJ=w@mail.gmail.com>
Date: Mon, 23 Jan 2023 17:03:04 -0600
To: "php internals" <internals@lists.php.net>
Content-Type: text/plain
Subject: Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callable syntax on
 non-static methods, statically
From: larry@garfieldtech.com ("Larry Garfield")

On Mon, Jan 23, 2023, at 3:52 PM, Dan Ackroyd wrote:
> On Mon, 23 Jan 2023 at 20:51, Larry Garfield <larry@garfieldtech.com> wrote:
>>
>> On Mon, Jan 23, 2023, at 12:32 PM, Dan Ackroyd wrote:
>>
>> >
>> > $fnConstructor = Closure::fromClassConstructor(Zoq::class);
>> > // signature of $fnConstructor is the same as `function(Fot $fot): Zoq`
>> >
>> > Or for individual methods:
>> >
>> > $fnMethod = Closure::fromClassMethod(Zoq::class, 'Pik');
>> > // signature of $fnMethod is the same as `function(Zoq $zoq, string
>> > $zebranky): Frungy`
>>
>> I don't think that actually helps.  If you have the object already,
>
> Neither of new functions I was suggesting have the object already.
> Only the type.
>
>> If you do not have the object already, then we run back into the issue
>> I pointed out before where we need to differentiate a bindable from
>> needs-binding callable,
>
> That's not what I suggesting.
>
> Danack wrote:
>>
>> $fnConstructor = Closure::fromClassConstructor(Zoq::class);
>> signature of $fnConstructor is the same as `function(Fot $fot): Zoq`
>
> That doesn't need a binding at all.
>
> Danack wrote:
>>
>> $fnMethod = Closure::fromClassMethod(Zoq::class, 'Pik');
>> signature of $fnMethod is the same as `function(Zoq $zoq, string
>> $zebranky): Frungy`
>
> First parameter is the object to be operated on. You wouldn't need to
> do any binding. *magic* would happen inside the function to take care
> of that.

Oh, I see what you're getting at.  I missed the signature on first read.  So you're saying that would generate a callable equivalent to:

$fnMethod = fn (Zok $zok, string $zebranky): Frungy => $zok->Pik($zebranky);

That's an interesting idea, though probably not self-evident to many people.  If we wanted to do that, I'd probably push for something more compact as a syntax, and a bit more auto-refactorable.  I think the Ara language had syntax for something like this, $$->Pik(...) ?  If I'm remembering correctly, which I may or may not be?

(We're also now rather far afield from the OP's request, I think.)

--Larry Garfield