Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127370 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 646AF1A00BC for ; Thu, 15 May 2025 08:11:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1747296568; bh=eJQalmTf3bbKEIf15+pRhzN9Wp9+qMgNNd8uQgWVEeI=; h=Date:From:To:Subject:In-Reply-To:References:From; b=ObKo+r7TWwd6ADCL7Fz7E904fGKXVpMekrM1pkz4bI/j61wrBWQwN/LHcNBiqbkKz C8kVOCvnfTzcCWeRsFARY7MtIhOfyR4wC298sQ7DtXwFMvOprdVdPxW6dRE1CUIx53 v/SAWiPeIWDDN7KUiXALm0OEkPth47LTCZE92XrBypO86v8dIAsWb0U4m4mPcWoGy3 CddohtBeMfamwL+LeVLew3AfX57g+zWUnrGgiMNGhA5ipXTk2+mNB1csYMslbQ7R+0 pxePVs42DZbzHn2RmMsLrtY/Jx0dMYZRwQAGUwcGVQOM7bwvBZINiAazoFCplTf5F/ 7tvxDh6yC575g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4C72118007C for ; Thu, 15 May 2025 08:09:27 +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=-2.8 required=5.0 tests=BAYES_00,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 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 fhigh-a5-smtp.messagingengine.com (fhigh-a5-smtp.messagingengine.com [103.168.172.156]) (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 ; Thu, 15 May 2025 08:09:27 +0000 (UTC) Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.phl.internal (Postfix) with ESMTP id 26B0F11400EB for ; Thu, 15 May 2025 04:11:37 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Thu, 15 May 2025 04:11:37 -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=1747296697; x=1747383097; bh=3nVYSwq2A6y4LNfA/1IafAjSMGTyG/RXNk9DDNV9zqg=; b= czjUehOqhAcFTAGdbSHT7IXPldG1brRBaAiMOm/pzigP9x8t2EJbg+KMXXMRhNlT R5AYVCsoYR7ecmmiVdpgPJwed9BeNFfSi0cqNIKrALpDyWMqEGJZUGCu90zM2qBf w7e70OYIqh0kOC8Ig4Ljc4petJkd8GeLRXt7auM0uqVsaoTgp0JSBegTbiSleEcg 4uLOnWgizpRv5kQZQtP4b6qgHgNPRUcscC0NZumD8TshBP4hQS9cdwMz0GJ6HjG8 d0GCu0/P8o7a3R0Ly7XVjpiIbrg9u/3A+TuXYXjuAuOgKZn9f0ONTLDBsGcyAQ48 Ur3L9z92HhX8EKGx5ogLJw== 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=1747296697; x=1747383097; bh=3 nVYSwq2A6y4LNfA/1IafAjSMGTyG/RXNk9DDNV9zqg=; b=HlbR6L/jLDq1Ohbkx dPSfWXMRbguIQ9WrAwseeMnmpQXuYsAuZ6wqSqqu/DO2Ljen5nc8q/Osub4pFbPN xWhwR+sUDCAFaD8izln4SGoTvbRF4f0XLpd+XmNdk25vQ7rqGKTc86xCkbalhkL4 cKeaZMP3OnpltmopquegPrMCrI8q6qP166+wXFtbbnVi7/VfRJ+gDjUOX1wfj8wj qGR1FpDmP8MkHm/WX6nku6+A/k+ks2A956e8LqL+3K5C7fLOInxy1j+G+Qv0ryLS X0L6b+PwURpIajiLnNHqMNfuiZkPFB5oHgnNA3hKQkKYlqKOdqWGjup3HtPYZJZ4 sVjBw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeftdelfeehucetufdoteggodetrf 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 ; Thu, 15 May 2025 04:11:36 -0400 (EDT) Date: Thu, 15 May 2025 09:11:34 +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: <9f6a0d6e-27c3-4f77-aed6-e55147442b6f@app.fastmail.com> 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> Message-ID: 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 14 May 2025 22:27:32 BST, Rob Landers wrote: > >As written, that simply isn't possible in PHP because there is only one c= lass allowed with a given name=2E Names of classes are global=2E I don't th= ink this has to be the case, though=2E Different languages take different a= pproaches to this=2E For example, JavaScript allows each module to "close o= ver" its dependencies so each module can import its own version of dependen= cies=2E I would say that JavaScript doesn't just *allow* this, as an added feature= , it *requires* it, as a fundamental design decision:=20 - In JavaScript, Python, etc, when you declare a function or class, you ar= e creating an anonymous object, and assigning it to a local variable=2E Cod= e reuse requires you to pass that object around=2E - In PHP, Java, C#, etc, when you declare a function or class, you are add= ing a permanent named item to a global list=2E Code reuse is about knowing = the global names of things=2E=20 It's worth noting that JavaScript didn't need to add *any* features to mak= e NPM, Bower, etc work; everything they do is based on the fact that decla= rations are objects which can be passed around at will=2E=20 That's why I don't think "JavaScript can do it" is relevant, because the *= way* JavaScript does it is impossible in PHP=2E We're much better off looki= ng at how *PHP* works, and what problems we're actually trying to solve=2E= =20 And that in turn is why I was reaching for Linux containers as an alternat= ive analogy, to think about the problem without jumping to the wrong soluti= on=2E Rowan Tommins [IMSoP]