Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129852 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id B2A481ADB1F for ; Thu, 22 Jan 2026 15:34:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769096050; bh=wkoc7Me4kXQYc5d4qMcBhghXY7Kao0TvAMYK2aCiwAY=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=BA0SKvQLPbC1hkgu8FxmscoOSp62/hVIjBQrdWfsiAdO+jGrQUD5G3pO0vNkfWll0 xI2sfh9zv6Cma7k7w7OrHgQmTlGXecX0v4DMaxOMsGs/ExkpBiRuwmMAMRN2if094A yczIg9oE49wfjdV75pRrLHHwXywRYXSBe8Ab7J7qIoXDcwyJvtm0cQPW2obghBStwc KIEfBbApEUy6ED72jOdXS44LuO8U7Js8oagMah1/BmHvGH5Ychm0OFrPfc3Nn4bw2A Nu3fq6onnJBv8KfVvFDvHyj/7vCsL6pH1iP9D+wwy0f6IY0Kj+uQ3bA9+Fpele0dHi KvyIAJz4VBGLA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4020D1805CF for ; Thu, 22 Jan 2026 15:34:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: *** X-Spam-Status: No, score=3.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_SOFTFAIL autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail.xdebug.org (mail.xdebug.org [176.126.244.128]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 22 Jan 2026 15:34:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769096040; bh=wkoc7Me4kXQYc5d4qMcBhghXY7Kao0TvAMYK2aCiwAY=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=hB0SrSqfb9+33ilfoCtKpZ2jKctl+VqVP4i25IPDF5VVwudVz4D4U5EQunrvHq29g 3pt8VSgmpJCEuHRTo052TqMbm1VZh6Q9rwgsJAJ/7M4khCirQlRgM7CIn15ghl+IfM U7ekbZ/Bj9RC0W3M96H9wHDCfvT4gIp1J7165Q3Ql3WbWxHllb7Y6qMiaAUPrQk8FV nGnbYc/s0blSMYKE6Ssw4vfIqB1XBIrS0K5zy2G7rMuIStAfS+7JUuIObf/lcgH4C5 kArvtAFIQYZoYfUaTc0jT2fFQiF/l78Qe6tayClV4+oEQ4207eeIDkIrbqaRybxtEA Nlm1jRO2Rz/JQ== Received: from localhost (localhost [IPv6:::1]) by mail.xdebug.org (Postfix) with ESMTPS id 0B7EF200BF; Thu, 22 Jan 2026 15:33:59 +0000 (UTC) Date: Thu, 22 Jan 2026 15:33:59 +0000 (GMT) To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= cc: php internals , Arnaud Le Blanc Subject: Re: [PHP-DEV] [RFC] Partial Function Application for instance of non-static methods ("$this") In-Reply-To: <64953ec741a4c6609519e1878ad37b54@bastelstu.be> Message-ID: <253ee811-0c1d-7eab-4c36-38607401aaf6@php.net> References: <64953ec741a4c6609519e1878ad37b54@bastelstu.be> Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1881066873-1769096040=:924205" From: derick@php.net (Derick Rethans) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1881066873-1769096040=:924205 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Thu, 22 Jan 2026, Tim D=C3=BCsterhus wrote: > Arnaud and I would like to start discussion on our RFC =E2=80=9CPartial F= unction > Application for instance of non-static methods ("$this")=E2=80=9D which i= s intended to > round-off the Partial Function Application RFC that was accepted recently= : >=20 > https://wiki.php.net/rfc/partial_function_application_this =09We propose allowing a named parameter $this: ? to be combined with the= =20 =09=E2=80=9Cscope resolution operator=E2=80=9D syntax of referring to a met= hod. I can't say I am entirely sold on the syntax here =E2=80=94 starting with a= $=20 makes it look like a variable. =09Since the $this: ? parameter does not refer to a parameter in=20 =09the underlying argument list and thus there is no ambiguity with=20 =09regard to positional parameters it may be placed at any position=20 =09of the parameter list=20 I think I would be keen on *requiring* this to be the **first** in the=20 argument list. Although there is no ambiguity, I also can't see why you would want to=20 have it anywhere else. And the RFC does acknowledge "instance methods which effectively carry=20 an implicit $this parameter that is provided on the left side of the ->=20 operator." With both these two above comments, I think I would like to see a better=20 syntax =E2=80=94 but I am unsure if that's possible. =09It may also not be used when partially applying an instance=20 =09method with a known object. =09$c =3D $dateTime->format($this: ?, "c"); // Fatal error: Invalid use of = $this placeholder Can you explain (in the RFC) what you mean by "known object" =E2=80=94 I do= n't=20 think the language on what this means is clear enough. cheers, Derick --8323329-1881066873-1769096040=:924205--