Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127357 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 5B06C1A00BC for ; Wed, 14 May 2025 14:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1747234517; bh=0tdtnwdvzna7Nw1+mORvEaQ8OwrX0DkOJd2iOIaMTYg=; h=Date:From:To:Subject:In-Reply-To:References:From; b=hDz3widMFB6eG92Y9bLxYqmo/axkpSso71tZCOdHKJTP5x9zRWsvV0usOF5ZBOre4 /GzBi813nx3qHDbd789BDqDp+UZl1A5LsCfE4CuYmZp+uuz0W4ae0XUgnMA6Math8q nGBy50qcG4ELwe0/YM+ZTAJGoU7dJTOi8c6az/YLGtZLDy01cXxWQu8gn0HVz8GEVR HF/LwJV0BEuiFtoOC5/kkHZu8o/E04Q6rHbq3qbNOtIyXSQBl/4dE08BSphsJlH22/ 19F2Uk7uQ/axXJ1CRgxfklysWqpYiWKYn/rJqtW2m7lRTM3K8K/89cbIu4cWOwaACn KeW63HI+wsxaw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E19D2180047 for ; Wed, 14 May 2025 14:55:16 +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_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-a8-smtp.messagingengine.com (fout-a8-smtp.messagingengine.com [103.168.172.151]) (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, 14 May 2025 14:55:16 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id 48D1313801CB for ; Wed, 14 May 2025 10:57:27 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-10.internal (MEProxy); Wed, 14 May 2025 10:57: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=1747234647; x=1747321047; bh=G9CozLdshN1XRZ7MKEW7hgDt5CG+RcVK0fs1Wbwy1Yw=; b= pypl6KxPr2Dyx6T2ZTD0w05qJMuYL/PivKdSox5pvYGN1AMNCb9uajRr99mE+eXK L5OgI2KsicN8D9d+Mj0HnndNuD05SRXzzzi98YM5tex3DfzTFPNuQYrtAW67qK/M n7YSPQVheImAQ/rGnds05rt/uQp3pP1FdsEZGRTrCcItmepb0m4Wtz/j3mHywnhw t6PuSpShaiIo+Mz107cf9vmwFLIdGky5ZILtMApJGGNCNndmlqoo3HNm4Z35BDW4 LXFIRNpq6r3q7LNJOWBhJqI6WMJ9i5Je2WXSZY8VovXFvpI7T0Kw62efm/x0Sk6L DsZNv7+THri4uPfwrLmm1g== 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=1747234647; x=1747321047; bh=G 9CozLdshN1XRZ7MKEW7hgDt5CG+RcVK0fs1Wbwy1Yw=; b=dYsbyRELjnP/BCUcX j0oe6lhM0rAk8nT33yuJTr0mifaoE4yh92ttoul4u8J+rJHFZeMKlb/hJYap/UhF qwdykv4saHtNzVP+rg+LGuuNx5/GjSeBfiKh9ucMQza1DqFa5xuWOmj5hozT/geJ G8ZhkDoTV3OonQHTGJLRLMygfPg3NBkFQZyZzJhjlGX2DYMCNczjYVDtw8YQqR1w ZpUkk2aVpmnM2DfPeQ0S3ATx9teJcf1HtOT/T6NAgYmdiAnp37YMTF2TGiZxLZ84 WGpa6IOQXS0gFEhnpPKEwXgxO/kFl5aLc9Y+u4Kyeu78dTsk6SzAXkjdXEHFqn9G sw6dw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeftdejvdekucetufdoteggodetrf 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, 14 May 2025 10:57:26 -0400 (EDT) Date: Wed, 14 May 2025 15:57:25 +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> Message-ID: <9A26F72B-D0EF-414F-B193-BED3CAB26A0B@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 14 May 2025 14:24:57 BST, Michael Morris wrote: >Well, it's what Go calls "modules"=2E It's confusing because I was being >truthful, not snarky, when I said "Ask 10 programmers for the definition = of >module and expect 12 answers=2E" I'm self trained, so I expect to get my >terms wrong from time to time=2E But I know enough to identify problems a= nd >needs and I've tried to be clear on that=2E I don't know much about Go, but at a glance it uses a similar model to Jav= aScript and Python where *classes don't have a universal name*, the names a= re always local=2E That's not a different kind of module, it's a fundamenta= lly different *language design*=2E If you want to use two different versions of Guzzle in the same applicatio= n, the first problem you need to solve has nothing to do with require, or a= utoloading, or Phar files=2E The first problem you need to solve is that yo= u now have two classes called \GuzzleHttp\Client, and that breaks a bunch o= f really fundamental assumptions=2E=20 For example:=20 - plugin1 uses Guzzle v5, runs "$client1 =3D new \GuzzleHttp\Client", and = returns it to the main application - The main application passes $client1 to plugin2 - plugin2 uses Guzzle v4 plugin2 runs "$client2 =3D new \GuzzleHttp\Client" $client1 and $client2 are instances of different classes, with the same na= me! How does "instanceof" behave? What about "get_class"? What if you seria= lize and unserialize? I think if you changed the language enough that those questions didn't mat= ter, it would be a language fork on the scale of Python 2 to 3, or even Per= l 5 to Raku (originally called "Perl 6")=2E Every single application and li= brary would have to be rewritten to use the new concept of what a class is= =2E And most of them would get absolutely no benefit, because they *want* t= o reference the same version of a class everywhere in the application=2E That's why I think "containers" are the more useful comparison - you need = some way to put not just plugin1 itself, but all the third-party code it ca= lls, into some kind of sandbox, as though it was running in a separate proc= ess=2E If you can control what classes can go into and out of that sandbox,= then in any piece of code, you don't end up with conflicting meanings for = the same name - just as a Linux container can't open a network port directl= y on the host=2E Regards, Rowan Tommins [IMSoP]