Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124283 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 1791E1A009C for ; Mon, 8 Jul 2024 09:41:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1720431761; bh=UWo1o75xoc9uhyJJMIJD1wGF3+WwGP3zx9dIcudCVF0=; h=Date:From:To:Subject:In-Reply-To:References:From; b=IHTyYdFRgLTRYPfAuP1FN8Wm/QmVhp5WEu1jtToYTlZh8i8Mxx0IyiU2HzkhmFtjN UnvlpTWQII3ivZ8iLvoTxtJcfdvcYbfn3Vaap6Z5/CiVkNRF/nKoG3iac1ae/9Fihk UcFhVxzXDYtASj+eh7DBkctAXXOQ2d12vrH3MuCGRnZBPL3bdo4DBuwW0LFAt2E5Rr Gfr5Lf2sBioj2FducaDYpMaxaAbHj872tdeivo0/Kxxw8Ii2vZEAvgLkkGUwxcDm4p deCBcHqu1Iy8Srp+j2JIxzFlNsqUtSXdlv/3FRcfYh9xOIjKOCqiVJJp8jgL6oNQ7Q qjASXbwC+WETw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2D4FA180893 for ; Mon, 8 Jul 2024 09:42:40 +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, 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 fout7-smtp.messagingengine.com (fout7-smtp.messagingengine.com [103.168.172.150]) (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 ; Mon, 8 Jul 2024 09:42:39 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.nyi.internal (Postfix) with ESMTP id 8DF991380A50 for ; Mon, 8 Jul 2024 05:41:14 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 08 Jul 2024 05:41:14 -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=1720431674; x=1720518074; bh=UWo1o75xoc9uhyJJMIJD1wGF3+WwGP3zx9dIcudCVF0=; b= ukcNVzMFU5zXqtIHJmnTPE2R3NYOYh1U1sBHDAtZDoMxn8NTcqoilipBdUsTFKC/ TJO6y/5pGWFWtVFpfOdmT+VbVuhSQ1ZxGGJ5sTqI6WFr+I7T1uD+LcNaw9JvmJEW ES4JF30hE9Y4Lc8QVoJQPxUYvSRnOjCws0DKeFsNImhmq5MBQZJLNxUiLO/thBtE kiTYSCovkTcGy/vL6njoZ/yYlZsydDdVRebD3LvORmqGMO5vMHZYiSqld5+uABee rZ0y7XOXLuEoXLorOhNC9W/NDwiL1DrqIRF0O7+mM9ERC0q040T9dncrR02W2jRX NoDL2NZXM2O59XBs+q8Nqg== 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=1720431674; x= 1720518074; bh=UWo1o75xoc9uhyJJMIJD1wGF3+WwGP3zx9dIcudCVF0=; b=P tJ/uGPua9vHcwef7McQo4lWdCJqHkpk3TlWNFgxb7xFfqxzZQsMlsb5+ASgA4+wY rJAjl3NC2PoHer4iaALnqiESRGfj41It7pB9+zIit3QWivRZR9fj0StVOOStmeVb N0SS0bbiKvqGJZXs96kd9kc/WX4UbnPMSHbMB1Xolu7ccgat+ydO5nCDHkKrB7QS yDfnn6+2gaFBHzf5wDf5qLFRmQAFS+aQWPNPg1ZBWtZ/8Czz+3r6BqnzCXI/2RSr 5pl5lu4InG/FeSlXVQz6qlkWnQMGlRDxFydhaGRPffFxED1XFp8gGDKU2MR9iNLZ jt8K56B/QMWYsxJ5IUFhQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdejgddukecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffufggjfhfkgggtgfesthhqmh dttderjeenucfhrhhomhepfdftohifrghnucfvohhmmhhinhhsucglkffoufhorfgnfdcu oehimhhsohhprdhphhhpsehrfigvtgdrtghordhukheqnecuggftrfgrthhtvghrnhephe elffetiefgveduteefudegtdduveeludegueegleehiefhhefgtdekveevgfelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhmshhophdrph hhphesrhifvggtrdgtohdruhhk X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 8 Jul 2024 05:41:12 -0400 (EDT) Date: Mon, 08 Jul 2024 11:41:05 +0200 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> Message-ID: <1BE6A849-A2A9-4E17-9C11-5099EF74F5C0@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 8 July 2024 04:25:45 CEST, Jordan LeDoux = wrote: >I think it's strange that this discussion has driven deep down the tangen= t >of versioning=2E=2E=2E [=2E=2E=2E] >Things like separating global scope between importer and importee, manage= d >visibility of symbols and exports from modules/packages, allowing for >separate autoloaders for things which are called or included via an impor= t, >etc=2E Those are the things that the language itself can do=2E > >All this other stuff feels like a distraction=2E I agree=2E I wrote most of the below a couple of days ago, but I don't thi= nk it posted correctly, so apologies if some people see it twice:=20 Autoloading is just a way to load files later, by the engine telling you w= hen a class is first needed=2E PHP does not, and should not, make any assum= ptions about how files are laid out on disk; an autoloader doesn't actually= need to load any files at all, and if it does, it uses the same include or= require statements which have been in PHP for decades=2E Likewise, installing packages and defining version schemes is a completely= separate problem space that can probably be served by a few small tweaks t= o Composer once the language provides the underlying functionality=2E The core of the problem you seem to want to solve is this: if you have two= files foo_1=2Ephp and foo_2=2Ephp, which both define a class \Acme\Foo, ho= w do you load both of them, so that you end up with two differently named c= lasses?=20 In JS, that's easy, because functions and object constructors (and "classe= s") exist as objects you can pass around as variables, they don't need to k= now their own name=2E In PHP, everything is based on the idea that function= s and classes are identified by name=2E You can rewrite the name in the cla= ss declaration, and in direct references to it, but what about code using := :class, or constructing a name and using "new $name", and so on? How will t= ools using static analysis or reflection handle the renaming - e=2Eg=2E how= does DI autowiring work if names are in some sense dynamic? You've also got to work out what to do with transitive dependencies - if I= "import 'foo_1=2Ephp' as MyFoo", but Foo in turn has "import 'guzzle_2=2Ep= hp' as MyGuzzle", what namespace do all Guzzle's classes get rewritten into= ? What about dependencies that are specifically intended to bridge between = packages, like PSR-7 RequestInterface? My advice: start with the assumption that something has already installed = all the files you need into an arbitrary directory structure, and something= is going to generate a bunch of statements to load them=2E What happens ne= xt, in the language itself, to make them live side by side without breaking= ? If we get a solid solution to that (which I'm skeptical of), we can discu= ss how Composer, or the WordPress plugin installer, would generate whatever= include/import/alias/rewrite statements we end up creating=2E Regards, --=20 Rowan Tommins [IMSoP] Rowan Tommins [IMSoP]