Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127439 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 CC64E1A00BC for ; Sat, 24 May 2025 09:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1748079141; bh=7jQ7E1o3L77UBR9iRUSP0vBSbVR3mLQqxaz9XtSWLJg=; h=Date:From:To:Subject:In-Reply-To:References:From; b=RZJM1a8aU0MEG3ZL5oOdcAwVn5qVolQ4//bZ4ZjQZ71F5JlRGUahJpN8ahT0K4J4s rYmeLFmpdueAB2hA5aRmmNVhDX3+x/BEMqt8ZPWTNIP2sGCxUR5eahuZy4EWzBr0ZM i+/v6a/3mlI1nQT6+yAyeSTXYNyXNETgu0lHwC9Hc++u8nsZEgr1NgZSO/Ekz+0FoH ws9L/sqZNIsfnaeNhJFXOZFSX4GayzfuocvuqNmDJP8KZjUCuthF7eTuAoDr6/dnvo dslVFWeLePFXq+BfZI2ulDluaa08R8QW9n00YpQu2dlw/7dCF81lY/k0LpBuUkp9G5 kvaiSTwOfZpfA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BD6A2180068 for ; Sat, 24 May 2025 09:32:20 +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=-0.9 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS 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-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (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 ; Sat, 24 May 2025 09:32:20 +0000 (UTC) Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id D030911400F6 for ; Sat, 24 May 2025 05:34:27 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Sat, 24 May 2025 05:34:27 -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=1748079267; x=1748165667; bh=7jQ7E1o3L77UBR9iRUSP0vBSbVR3mLQqxaz9XtSWLJg=; b= LswyI91e2+XlhYlB5McalbowZPcR8LnFUVFFpP4uEfC9W/7KILgQleFn5kcvcZcx lZknAns73l7FdcPVRrNl9RBZ8Da5DOGU24ieqzZuMQCbIzJAOn4Hnvvu0GQ4PYVp zuQTOaDY40DqRyhmkZDrzKOZCPAUn/U5E2nhf8Y3Z7MEQcGRdJQxa/d7jiwLICeT isb/DMBSqRLAxUxqp4hil/yD6xKNmnpf8pLZYV82Vub3NnlmuCpSIhnjQ5BcUZ50 8mwZqFucqRrYvAIgC1tO4wxcKGAO6pThPIbO/kgkoh+TfZtMLnJWE9bw8qVSD4CW 3sifURD/7IS/QDjvuwPviw== 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=1748079267; x=1748165667; bh=7 jQ7E1o3L77UBR9iRUSP0vBSbVR3mLQqxaz9XtSWLJg=; b=S85Z+jFpgWxTdfWNl koAqBnxwGnBxPLZBdDRlqJvtV0T8dSlNktBwfJ0SlZPwtj0d//Mwb0PJg8R1GaCL RLmaGoiCY+VEB7K934jnW8q/+FMgTygLWC1Vj655UkCangSSMRhmPcvwFBkVg0YC BbXNTqSyK5/BISpl1SMuJXJc7S6qUnj0AF/xpex8MbE+MqOLa19DWWwOvpqXd7Kj ERl6jb98IDcQ8hoLj9xnMtZPhVSq0hwmHFnCJGtRL236TCSBfEKd7jaiO5LZTbzo udI7qQeH2+L/ijlwgiXziaF20oUGhVJi4abrOgrIvYSljTfkmn58p0LJimopgRVZ P6MQg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddtgdduudefjeculddtuddrgeefvddrtd dtmdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggft fghnshhusghstghrihgsvgdpuffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftd dtnecunecujfgurhepfffhvffufggjfhfkgggtgfesthhqmhdttderjeenucfhrhhomhep fdftohifrghnucfvohhmmhhinhhsucglkffoufhorfgnfdcuoehimhhsohhprdhphhhpse hrfigvtgdrtghordhukheqnecuggftrfgrthhtvghrnhepheelffetiefgveduteefudeg tdduveeludegueegleehiefhhefgtdekveevgfelnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepihhmshhophdrphhhphesrhifvggtrdgtohdr uhhkpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhope hinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 24 May 2025 05:34:26 -0400 (EDT) Date: Sat, 24 May 2025 10:34:24 +0100 To: internals@lists.php.net Subject: Re: [PHP-DEV] Module or Class Visibility, Season 2 User-Agent: K-9 Mail for Android In-Reply-To: References: <3ae9a6ea-f135-472b-b2bf-e6cd6ebad299@app.fastmail.com> <9A26F72B-D0EF-414F-B193-BED3CAB26A0B@rwec.co.uk> <9f6a0d6e-27c3-4f77-aed6-e55147442b6f@app.fastmail.com> <673fd2db-b07f-439b-a4f2-e9519108d159@app.fastmail.com> <78641D8B-AF1D-4912-920A-D75A37C32F05@rwec.co.uk> <354cb888-97c4-4f8c-a0da-359d1e63c0f9@rwec.co.uk> Message-ID: <10D95B6E-094B-4EAE-A18A-AF6B795CB352@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]") Hi Michael, I'm going to skip over all the details about the autoloader for now, becau= se I think they're going deep into implementation details, and I want to fo= cus on the same top-level design as my previous email=2E On 23 May 2025 02:27:41 BST, Michael Morris wrote: >Bobs docs needs an older version of Monolog and is configured appropriate= ly >in its composer=2Ejson file, so =2E=2E=2E v1 is prefixed to the >namespace declarations in Monolog\Logger and the file is included=2E The >engine aliases BobsDocs\Monolog\Logger to \v1\Monolog\Logger=2E If I'm following correctly, you suggest that we would end up with class na= mes like this: \v1\Monolog\Logger \v2\Monolog\Logger \v5\Google\Client \v7\Google\Client It feels like there's a lot of complexity in the package manager here - it= 's got to keep track of which versions of each package are installed, what = they depend on, and decide what prefixes need to be used where=2E You also = suggest that one version of each package is left with no prefix, which adds= even more complexity=2E >The Googl\ApiClient of BobDocs is again, up to the autoloader=2E Assuming= it >too is different (since it's using an older Monolog) The biggest problem comes when this assumption doesn't hold=2E I actually = chose these particular packages to illustrate this problem, then left it ou= t of my previous message=2E It happens that the latest version of google/ap= iclient supports both monolog/monolog 2=2E9 and 3=2E0, so it's possible to = have:=20 - AlicesCalendar wants to use google/apiclient 2=2E18 and monolog/monolog = 2=2E9 - BobsDocs wants to use google/apiclient 2=2E18 and monolog/monolog 3=2E0 If the package manager is adding prefixes to individual package versions, = we will have one class called \v2_18\Google\Client containing our familiar = "new Logger" line=2E AlicesCalendar will expect that line to create a \v2_9= \Monolog\Logger, but BobsDocs will expect it to create a \v3_0\Monolog\Logg= er=2E We can't please both of them without creating an extra copy of Google= \Client with a different prefix=2E So the version of an individual package isn't enough to decide the prefix,= we need to know which *set* of packages it belongs to=2E=20 My suggestion uses a much simpler rule to define the prefix: if it's loade= d "inside" AlicesCalendar, add the prefix "\AlicesCalendar\"=2E All the cla= sses that are "inside" are completely sandboxed from the classes "outside",= without needing any interaction with a package manager=2E As far as I know, this is how existing userland solutions work, and I have= n't yet spotted a reason why it needs to be any more complex than that=2E Regards, Rowan Tommins [IMSoP]