Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127315 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 B01781A00BC for ; Wed, 7 May 2025 22:23:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1746656504; bh=Ugdsl2fMC2TJeML9jT8NNQFfvo7T5xDl/WzSTZydL5U=; h=Date:From:To:Subject:In-Reply-To:References:From; b=WBNn3vSdo1X/f30rTRcCMBGJkR6B513pIuPLazbmL2IRmU4W4zvX3WPfh8uNOHp5q vh6BNt4JUaXf2aneZqxNBzVqrp8i3/QUub4E+XL0AuOSH4pp1i21PqWNsivlDS3Bfp v+XaK4m6GEKiRpkNhnki0JGEA95z4yaw81TFJz2CE5awoLmj8kPP3OyqXK4UYB621r v02Cwl9nxRxnPxRtQYTyVKlnTxZuqOYhD9BFqICLYHjOVnKPOT4hvCrlriNrIlsQra JNPwueb8pTxvl1fQxJdTMxtWZq5ULdMiEi58cFjCscox5ItNGDO2h3u+/JIXkbshSw QacqM84ODd6dw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BE32C180057 for ; Wed, 7 May 2025 22:21:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fout-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) (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 ; Wed, 7 May 2025 22:21:43 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.stl.internal (Postfix) with ESMTP id 74BDC114015D for ; Wed, 7 May 2025 18:23:56 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Wed, 07 May 2025 18:23:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; 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=fm3; t=1746656636; x=1746743036; bh=A6nHmHVle0Mo625vwN4ZCo9rU1sDXpWiz94bPWJCelI=; b= Oig5NH+IDYkW9+Ol0066+jEOO4iSNpJTbbsjLwDHDGYjbMUfzwoFXaudXtegZ8ND 0qyKAEpkvGI3BAVSYo1LvaQys7wnzRbLrM0UFjugsZSq9lI7Zp0qr6YBZKJDPRgQ 8GGlxyYBgWr42VVTdPjSrXs16G8/ZPznYiJAhR4OHJVLCfO1OdPWCelSmoxerdyu y1EdjUrtY18KXuWPh/ZDZO9Rov3Bwy5GXAXByD9/A2EVjRsAO8tW0d1CLPgWkqor gD/JsoZMWJnvAE9CqIP+RGPdhvGwXtXaI7V0RUCUFNzMKj2MhEcjYK17fmYgJUH2 b3gkTEISqfs4tHer0gXoHw== 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=fm3; t=1746656636; x=1746743036; bh=A 6nHmHVle0Mo625vwN4ZCo9rU1sDXpWiz94bPWJCelI=; b=TOSYyOxJ678Onz5qX q5rIGiJNOT0q7YnxeVNPBDZxlbgnsZUN17KXaM7NGgF5TDwCOVXxgAAtExQXjVF3 Npp7FtfrVSDx95lF5RUSolonLHsOffNRQBwzk6EqAPjM5K5Ls2h4hB7UtWd4wwkG zTqiHCIAQUeiWLow5WScNWmjuMT12G9+5A9OnFxBbfkj21RmNoP5eDhXDbYQ/ejj lQd7ZbUldLULgZPYA1RjT7SRSrGTF780T1VbYMVR1VwC6ze89z+JlWx0KxVTSKvH p+b6i+uFvTIvsRaWXcio40ajWhT2j841JDdKOZLJvJS6E6slD/xZnlggwrUvdMlr zLBCg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvkeektdehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpeffhf fvufgfjghfkfggtgfgsehtqhhmtddtreejnecuhfhrohhmpedftfhofigrnhcuvfhomhhm ihhnshculgfkoffuohfrngdfuceoihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqe enucggtffrrghtthgvrhhnpeehleffteeigfevudetfedugedtudevledugeeugeelheei hfehgfdtkeevvefgleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehimhhsohhprdhphhhpsehrfigvtgdrtghordhukhdpnhgspghrtghpthht ohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslh hishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 7 May 2025 18:23:55 -0400 (EDT) Date: Wed, 07 May 2025 23:23:55 +0100 To: internals@lists.php.net Subject: Re: [PHP-DEV] Modules, again. User-Agent: K-9 Mail for Android In-Reply-To: References: <6d2adbbb-f4fa-41e6-9ec1-179685ded039@rwec.co.uk> Message-ID: <6F998CFB-2538-4BF3-B7A2-1A9A68EB79FB@rwec.co.uk> Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 7 May 2025 21:51:29 BST, Michael Morris wrote: >On Wed, May 7, 2025 at 3:24=E2=80=AFPM Rowan Tommins [IMSoP] >wrote: > >Other libraries have the means to import into a namespace because their >namespaces aren't just a quick and dirty string replacement=2E I've even >proposed such a long, long time ago - allowing namespace to be the second >argument of require, only to have that shot down as "require isn't a >function=2E" or some such=2E I've no idea what you're saying here, sorry=2E I never mentioned autoloadi= ng in my message, because it's largely irrelevant=2E What's relevant is how= you identify something that's been declared (e=2Eg=2E a class)=2E >> The main exception, as you have pointed out, is plugin architectures >> like WordPress, where the plugin might want to "privately" use some >> library without impacting the host application and other plugins=2E > > >It's not just WordPress=2E That is why I said "plugin architectures like WordPress"=2E I am absolutel= y aware that it is an example, not something unique=2E >I've seen Strauss in action=2E It's called monkey-typing=2E Other langua= ges >support this sort of monkey typing to some degree - PHP can only do it by >doing an expensive and error prone programmatic keyword search of the >source files and transforming them=2E The end result has to be shipped wi= th >the module, severing its dependencies from getting security updates=2E So, you don't like the first example I happened to pick in a 10-second sea= rch=2E=2E=2E More interestingly: Firstly, can PHP do something to make the rewriting easier? I've no idea, = but if so, let's talk about it=2E Secondly, can the rewriting be done at install time rather than in advance= ? I see no reason why not; seems like something to tinker with in a Compose= r plugin, off-topic on this list=2E >I *do* think PHP would benefit from some native concept of "module" for >> other reasons, e=2Eg=2E marking internal components, optimising across >> multiple files=2E I *do not* think that ES/JS/TS is a suitable model to >> look at, because it is starting from a fundamentally different concept >> of what a declaration is=2E >> > >So what do you suggest then? Go's model? Rusts? Gradle or Maven from >Java? Shooting down stuff is trivial, finding solutions is the real work= =2E I suggest starting with what we already have: build modules on top of name= spaces, not as something new and orthogonal; and leave package *management*= (version resolution, installation, etc) to userlan, while recognising that= Composer is overwhelmingly the most popular implementation=2E That probably means that rewriting namespace prefixes remains the only way= to isolate "private" versions of a dependency, and I am totally fine with = that=2E Rowan Tommins [IMSoP]