Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127638 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 BBD1F1A00BC for ; Tue, 10 Jun 2025 20:10:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1749586079; bh=8IT6OV7jyr3jT5SUt86aiIA7waRcPNLB3gAo3QX9E4Y=; h=Date:From:To:In-Reply-To:References:Subject:From; b=WGRPHi9vg/MeuVDQk7xW9Iwp4jwKS+00XxH70L/X680ZfKVc634FwT0WpHuesRgIk ll000nbrV4qaymNruuU+KdbCm0q7Q7PSOeh5IHGIWDuh7BLyLFeLrXa1U/aMpSKlcr kUQI5TdWnlLwE35heryq3AAl1ZHToUYAWjgfM/ScgbV9zJ9iYIJGpJ90YJe0IuBAfh BUcmLbYK3taDGmuVJMDRm8c/Tk/C19EJr/jqwKFlSAqUy+S5t/fPKfMZWx05g/fyVc YdLD51QyQi5PuKy2ZZnrnXlK61wkCZHF7PHVHIh1FAJsHFyHipMGgTPNON4qFipB6d MMgC4T5utzeAA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6715318004E for ; Tue, 10 Jun 2025 20:07:58 +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=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fout-a1-smtp.messagingengine.com (fout-a1-smtp.messagingengine.com [103.168.172.144]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 10 Jun 2025 20:07:48 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id CC0551380128 for ; Tue, 10 Jun 2025 16:09:48 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-10.internal (MEProxy); Tue, 10 Jun 2025 16:09:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm1; t=1749586188; x=1749672588; bh=mqfbn+LxphPMpfSZ8Kk1x iWhbImuWztYQ9Eoz/Htg6I=; b=aMuHfmTPmIiziobtSbmIZ+V4/LD5rWf0VxQGD EYeOpv+moJz6wpCZce2JNfagdp2ClrXplcKdOeWwo9VXLpRiRfN0Tkm+nFsqyF68 Ibdih2TJAlExOciVYsTQOqx8qnS/NaxCfTVG3ZuT9nB2ke4qlhwKdyLK6JHhmzEx VYuoVZZTvoHCD/OZ2hJC5cppKkd7su7NKx8n9sGygk80iz+61zaBNwygLbWncl1M c3sADrr52VxPlxhnhrRIj19tcQ6OWDPhqwV/bxBnL9SWQ5h6vnOjRehehwwASws0 DqXvH7Idlkpqbkh5+6Yr+8Qw1mR9H/lzQY/MqSNLpb5YZ++zQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1749586188; x=1749672588; bh=m qfbn+LxphPMpfSZ8Kk1xiWhbImuWztYQ9Eoz/Htg6I=; b=H7g8U40ObDwYpRlLW iree2AmwFHxN8NqMLBpgXt/ArklVxcOQZYyxEQ6SWyl4/0kTivlmlb5EBfxfo1W5 SOCFL3to6ZdBH/NXalyOfDTg+wyf9dLs8zDetpMI6GAIGtbHZ5RGnloPDFL7DfOP GpiHcFucNySLU36rJu4YFHlJSj6nFiVYb7oZLc/M9BbpCRU5nLPlPxyPuNOH3E8/ VDCP3UATeZTDKZyQUKJhYjx7Vk1c3viyohpIJZefHzFuVxquQYxNoSz8yzeVNJM7 h8iZ5j6X5E2umzgm9zJ1Fy1bgvkRF9oxuRq0xl5Qup1IBcA86jcG+5v3cpLcigD2 cKcqw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdduuddvtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefoggffhffvkfgjfhfutgfgsehtqhertdertdej necuhfhrohhmpedfnfgrrhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfh hivghlughtvggthhdrtghomheqnecuggftrfgrthhtvghrnhepffeiiedvhfdvgedutddt geetieeugeevhfetheeffeefteduiedthedtgeejueeinecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgv tghhrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtph htthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 5B7FE700061; Tue, 10 Jun 2025 16:09:48 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: Tddf95baf0bdb99dd Date: Tue, 10 Jun 2025 15:09:28 -0500 To: "php internals" Message-ID: In-Reply-To: References: Subject: Re: [PHP-DEV] Feature Discussion | Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Tue, Jun 10, 2025, at 2:45 PM, Dmitry Derepko wrote: > Thanks for participating, Larry. > > On Mon, Jun 9, 2025 at 10:29=E2=80=AFPM Larry Garfield wrote: >> 2. Please link to a PR of your actual implementation. In context it = looks like your branch comparison link is to the version you said didn't= work, so it's not that helpful. > > Correct, I don't have another one. This is big feature, I need a lot o= f=20 > time to implement it. I don't want to waste my time if we decide that=20 > RFC won't pass at all. Understood. >> 3. The biggest question that has come up in the past (Ilija and I hav= e discussed it at length) is, naturally, autoloading. How if at all do = you address that? > > In the original message I mentioned `use extension` construction. This=20 > should be enough for solution, isn't it? Very much not. The `use` construct has no bearing on autoloading curren= tly. Autoloading happens only for classes and class-like things (interf= aces, traits, enums). If a function is not found, PHP just crashes. Va= rious solutions to this have been discussed over the years, none of whic= h ever made it as far as a vote. I toyed with the idea of having extension functions compile to a static = method on a class as a way around this, but of course then you end up wi= th a file-per-function, and the file name has to match not the function = name, but whatever mangled class name gets generated. Not at all intuit= ive. In fairness, I think with universal opcache, preloading, and the increas= ing use of persistent processes, just skipping autoloading for functions= and front-loading them via composer.json's "files" block is fine for th= e 80% case. But it feels like I am in the minority on that position. >> 4. The other big question was determining when to match a given "meth= od" call to an extension function, when the type of a variable is not al= ways known at compile time. How did you address this? > > Cannot understand the passage, could you explain more? x & $this->y; } function doStuff($p) { // At compile time, we don't know that $p is a Point. In fact, it may = not be. // The function will allow any value here, even a non-object, so it do= esn't know // if this should be compiled to Point__area($p) or left as is. print $p->area(); } The only way I could think of to handle that is to have a method call "t= rap" similar to class autoloading, that when hit checks at runtime "hey,= this method didn't exist, but is there a `use`d function that would mat= ch based on the runtime type of this value?" But Ilija felt that would = be prohibitively slow. It would certainly be slower than just a functio= n/method call since the trap takes time. And then we get into questions of inheritance, and, well, it gets even m= essier fast. One possibility that we riffed on during the pipes discussion (mostly of= f list, I think) was using +> for some combination of extension function= s and Elixir-style first-arg pipe passing, so that $p+>area() would sign= al to the engine (compile time or runtime) that area() wasn't a method b= ut a function that should get $p passed to it. That would solve the "tr= ap" problem, but still doesn't address autoloading, the lack of compile = time type knowledge, or how to differentiate between Point.area(), Shape= Interface.area(), Rect.area(), etc. --Larry Garfield