Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114813 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 94061 invoked from network); 10 Jun 2021 14:19:04 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Jun 2021 14:19:04 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 317CB1804E3 for ; Thu, 10 Jun 2021 07:34:21 -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=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE,URIBL_SBL,URIBL_SBL_A autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (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, 10 Jun 2021 07:34:20 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 463F55C0164 for ; Thu, 10 Jun 2021 10:34:20 -0400 (EDT) Received: from imap8 ([10.202.2.58]) by compute3.internal (MEProxy); Thu, 10 Jun 2021 10:34:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=TU+YLU 7Nf71Wv2prq/7rbDME3Nm+2nRc9piUXWljOvY=; b=fN+WRIADR+CS6cHgt3vmC6 3JHGm3SZ5BRLoLTQhmYCCywtaBm4LAYNj1jekiFEGDwqPfpJJAOeaZuP740w3Hxe pJZDjPMgZO/fHHdfBne4O5zkXKexk7yhrd8itnciJwXsoBYMxu4JTudNFm0yFYqN WMBceLW6FZjqDcEaWXaPOl1beK2uwgaTBW7wNwsME2BcBU4YU/LF2GIBopZsFJ2Q SLqb8I+ZWIivNRVE9DcELL4qcxHVXmNXROE0QZ4oQcwBxyT0sczf8Vu/So99b+0Z FVrVlUmxltaT80qWSQqUQEgUDVd013QDUhcVb2WXnrtGAATN/tgS6ieYN4QDxCvQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedufedgjeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpefhhfehteehjeevtddvheeftedvffefjedtffegleek ffelgedvvdevleegkeegfeenucffohhmrghinhepphhhphdrnhgvthdpfehvgehlrdhorh hgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgr rhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id EC3323A086A; Thu, 10 Jun 2021 10:34:19 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-519-g27a961944e-fm-20210531.001-g27a96194 Mime-Version: 1.0 Message-ID: In-Reply-To: References: <9adf063b-2598-4dd4-9e2b-cf2cd4f53b86@www.fastmail.com> Date: Thu, 10 Jun 2021 09:33:57 -0500 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC] Partial Function Application, take 2 From: larry@garfieldtech.com ("Larry Garfield") On Thu, Jun 10, 2021, at 3:17 AM, Guilliam Xavier wrote: > On Wed, Jun 2, 2021 at 7:47 PM Larry Garfield > wrote: > > > Hi folks. After much off-list discussion, iteration, and consideration, > > we have a new draft of PFA ready for review. > > > > The URL is the same: > > > > https://wiki.php.net/rfc/partial_function_application > > > > Hi, thanks all for the reworks! I just thought to something: does it > support nullsafe calls, e.g. `$foo?->bar(?)`? and if yes, what is the > signature of the Closure when `$foo === null` (and does it make a > difference if, inside a function, it was created as a local variable `$foo > = null;` vs received as a typed parameter `?Foo $foo`)? I just checked, and it... sort of supports nullsafe. Rather, if you try to partial a method on a null object, you get null back for your closure. Then when you try to call it, you get a "cannot invoke null" error. Which... I think makes sense. cf: https://3v4l.org/4XeB3/rfc#focus=rfc.partials As a cute side effect, Joe pointed out you could do this: https://3v4l.org/ERRdY/rfc#focus=rfc.partials I wouldn't really call that a feature, but more of a side effect of the implementation. Please don't count on that behavior. I also discovered while checking that nullsafe differentiates between null and undefined. That was unexpected, but not related to the topic at hand. :-) > Related, for `$null === null`, is `$c = $null->bar(?);` / `$c = > $null::baz(?);` an immediate error, or only later when calling `$c($arg)`? That dies with "call to member function on null" when trying to create the partial: https://3v4l.org/E6MgK/rfc#focus=rfc.partials --Larry Garfield