Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124304 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 qa.php.net (Postfix) with ESMTPS id 851821A009C for ; Tue, 9 Jul 2024 07:10:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1720509108; bh=BvtzQJ8loGikxygzY2aczAsy9N7X37U4pld/1n6XD5E=; h=Date:From:To:Subject:In-Reply-To:References:From; b=a/pE8NDazPkWuVLRa6cRvxpmgDaA5TmbbveHdrCLG2AWFKnzZRqCyiE4CaDBUgFCk CopQpykgWAvs6VPeiJsbVsu83MA8NrYtr+is+d1rJR/zUR9rHnwuPH7h9Q1yUfc7SW KLbw58qc96VXAm1fZWyNBcVHfGH+kadKFrSk0dvsgGXlDVl79LIwa2IbPP8nzBIMLg q7vU2S1cwZY/wxVHfKqmqVZivgzti55+zkr58W/xQ1J5mD7GVQ7GchoBo0UpGboAXs 4pJKi54ZSCIVASia2TqfoEzPtKAVFJ9N6pS/RxpWlws5fpZVi/VU2RCMhamgkDpgOl OyJ62VcSB85Eg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3695418005B for ; Tue, 9 Jul 2024 07:11:47 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 fhigh1-smtp.messagingengine.com (fhigh1-smtp.messagingengine.com [103.168.172.152]) (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, 9 Jul 2024 07:11:46 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 0F5D81140DCE for ; Tue, 9 Jul 2024 03:10:21 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 09 Jul 2024 03:10:21 -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=fm2; t=1720509021; x=1720595421; bh=BvtzQJ8loGikxygzY2aczAsy9N7X37U4pld/1n6XD5E=; b= Ab7S3rESW7edHg4hCXFPS4qTNhYdH57jm317K0m8M957hybgu1FZoypl+agFj84G 2ew8sTQt9/BPgNLQRyWP5tvMbGjEQcjWSVkUNmnagIE/P7gnI/so2zyRUb7cJLCW CCjkqpo1SKTvlAtdw/laLqfqF2m7XIGuD0hgBzWoSSqwwYWYP02cGWbr385jf5/L TRmW8NHrGe4XRj7LfmnIg6tiipnfYGng7zj/xtSRt06icJOQ9uxvvvYy5EPW9yak fBIhzSXxo2UNdrVPMgYGO66FNueIticPV/v+S6kZ/3Kf2FoW0ErTn5We+BQL0nEv pOLILaEy6umoBeCm3JHtXw== 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-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1720509021; x= 1720595421; bh=BvtzQJ8loGikxygzY2aczAsy9N7X37U4pld/1n6XD5E=; b=d VTq+DFRUE5mFPXWGIua4moKL6W9pnhTsxTFDumPpD/9JX8W41FubWOjJcjeQ8vXe rgtNqV+7G+6qjrKw1vuIqelm4SfHI9snm0PeucjSika69L7EzNgwt+uPyDDX20Oh YF5/stsUu14w2ndsp6d6DM3FMRRWgFY6jSZt3pRl3Mr8fouR6nnJRZ5248/AH9PK DpNduJDt8+mAodrHT5nl5y7bq+kMivaUFJ/MOKhGE29G9pEJVKZZRDjfP1Ttlnra VG9l667VMZieRgNZTZgjaRk6QEtSE7u7AbmS4uDjLEToLmn4qqSzUpYwtzcN4FSO DLmSsIToD+/wm2jLy2MCA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdekgdduudeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvufgfjghfkfggtgfgsehtqh hmtddtreejnecuhfhrohhmpedftfhofigrnhcuvfhomhhmihhnshculgfkoffuohfrngdf uceoihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqeenucggtffrrghtthgvrhhnpe ehleffteeigfevudetfedugedtudevledugeeugeelheeihfehgfdtkeevvefgleenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehimhhsohhprd hphhhpsehrfigvtgdrtghordhukh X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 9 Jul 2024 03:10:20 -0400 (EDT) Date: Tue, 09 Jul 2024 08:10:16 +0100 To: internals@lists.php.net Subject: Re: [PHP-DEV] [PHP-Dev] Versioned Packagers (Iteration IV) User-Agent: K-9 Mail for Android In-Reply-To: References: <09559430-4477-4516-8D78-6F4071E1AA6C@newclarity.net> <0182F3D6-F464-477F-9029-A2D0A8B50C71@koalephant.com> <1AFD7AAE-8BEA-460D-88A8-15BB3D30A775@koalephant.com> <1BE6A849-A2A9-4E17-9C11-5099EF74F5C0@rwec.co.uk> Message-ID: <98D6A4CA-EBFC-44CC-9DD4-14C0D7AF0AC9@rwec.co.uk> Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net 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 9 July 2024 04:24:59 BST, Mike Schinkel wrote: >I think maybe you are replying to an earlier iteration by Michael Morris = and have not seen the more recent iteration? =20 I wrote the message a few days ago, but it didn't post; but the more recen= t discussion still seems to be focussing on things that can be solved in us= erland, rather than the fundamentally hard parts=2E >There he explored adding an additional function to named `spl_autoload_ma= p()` where the difference from `spl_autoload_register()` is that while the = latter uses procedural code to determine what should be loaded the former w= ould use a declarative map to determine what should be loaded=2E Then Compo= ser and/or other tools could/would generate that map for PHP=2E You can implement this in userland, right now=2E The point of calling proc= edural code for the autoloader is that it can do anything it likes to defin= e the symbol - it can look it up in a table of directories, it can load som= e code from a database and eval() it, whatever you need=2E In fact, Compose= r already does implement such a file map, that's what its "optimize autoloa= der" option creates=2E What you can't easily do is run different code depending on where the symb= ol is used - but since the autoloader is only called once per symbol, doing= so wouldn't make much sense=2E >> My advice: start with the assumption that something has already install= ed all the files you need into an arbitrary directory structure, and someth= ing is going to generate a bunch of statements to load them=2E > [=2E=2E=2E] >What works for user-managed apps is that each `add-on` (`plugin` in WordP= ress, `module` in Drupal) is stored in its own self-contained directory con= taining its own vendor code Note that I said "arbitrary directory structure", not "PSR-4/Composer dire= ctory structure"; the files are on disk somewhere=2E PHP didn't put them th= ere, some application did=2E The application knows where they are, and need= s to tell PHP somehow=2E > =E2=80=94 where some of the vendor code could easily be duplicated in an= other add-on This is the hard part I was suggesting you focus on=2E > and then the user-managed apps itself manages loading of all add-ons its= elf without a PSR-4 autoloader=2E As it exists, there are no standard for h= ow add-on filenames and directory structures much be named nor how they are= to load their dependencies so it is impossible for WordPress or Drupal to = take on that role using PSR-4 for them=2E WordPress doesn't need PHP Internals, or even PHP-FIG, to define how plugi= ns should be laid out on disk, and to write an autoloader for whatever they= come up with=2E >Michael Morris' idea to add an `spl_autoload_map()` function would allow = addressing the needs of user-managed apps that treat each add-on as a self-= contained entity=2E But making the assumption that "something has already i= nstalled all the files you need into an arbitrary directory structure" is n= ot sufficient for the problems Michael Morris and I have been trying to add= ress=2E It doesn't need to solve all the needs of the application, it needs to sol= ve the parts we don't already have=2E WordPress already knows how to downlo= ad files to disk; it could trivially design a system for plugin authors to = lay out their own classes in some agreed layout and write an autoloader usi= ng the functionality that's been around since PHP 5=2E3=2E The part it can't do is load two classes with the same fully-qualified nam= e, because the language has no base functionality to build that on=2E Desig= ning configuration files is a complete waste of time until you've designed = that base functionality: when you load two classes with the same fully-qual= ified name, what exactly do you want the engine to do? What will need to ch= ange in the core of the language to make that possible? Regards, Rowan Tommins [IMSoP]