Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127351 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 CBF0D1A00BC for ; Wed, 14 May 2025 08:08:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1747209985; bh=pNSZRK+SbLzWDqnqjg2ghlUcxV+OEGtkjlLDbGUccs0=; h=Date:From:To:In-Reply-To:References:Subject:From; b=G4Oa0w9ZxcPNuF7DuMpdBIaqmd5o3FDaFNr5e7REE8uWLzNw/dgyvO8gATXl6ycJH l6PUV5nKlJJKrPgyJbZHdaS9cKpjEMnMqF9cPU2+az/WuzjkZIe6FBeN3D+cKyxoPe ZSsvv7R3o1+9UIXMmXs6iA7icR1yiaXDGz6TYnaX+3nP/6FfQnLPmv0+RJhpKspAA9 qlKKKV70qZdkg4RJ2swb7YVmm0ufqyVv2ykb9LN9Q7FX3FqqZq0y1mRSRA0W0nhsyf ybszi3wfkUJO0E8QzKUXX/YRIQUfGkaeTGsK45bNbJAuW0zR4HmdDiz+LXNGVkrLji v3JLwsfUZnoFA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C2020180051 for ; Wed, 14 May 2025 08:06:23 +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,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,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-b1-smtp.messagingengine.com (fhigh-b1-smtp.messagingengine.com [202.12.124.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 ; Wed, 14 May 2025 08:06:23 +0000 (UTC) Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfhigh.stl.internal (Postfix) with ESMTP id 28D0B2540131 for ; Wed, 14 May 2025 04:08:34 -0400 (EDT) Received: from phl-imap-10 ([10.202.2.85]) by phl-compute-08.internal (MEProxy); Wed, 14 May 2025 04:08:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :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=1747210114; x=1747296514; bh=R9QAUrNLyB wuqGUeljTXaDJTPKsAcQqC5xe52jPl64c=; b=t3ZRQHD6u+HQgb/oK3Nbx1eNJD W+OzMqQmKasJuZ/wg+tT67+A65LCZCuCNZDAtzq6LQQccy4KSJvREFvx5f7C/vug z6546fCNb3pBfg3yAuGzFEE8LmVKuMhPzWTP7iBAOW1fOpRaz+7ViBxdACKzVGcL k7opqIP1+aJiHsECVQqKXWCoMX/JzqT/HaSMi100bv5ctz5YRyz2Fee//B3CIoT6 tPeMZWUiHwzrTZRIWRfz4PwSQM3v/7KQ048nkFcWSinBcghu0IQ+sznTdcUWVd1y 4BW9bC62suWxDyUzcP1bBAl2mrgQvBaF10da/koDO1/qqCPTPx3U8R0DCyPg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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= 1747210114; x=1747296514; bh=R9QAUrNLyBwuqGUeljTXaDJTPKsAcQqC5xe 52jPl64c=; b=NQ2nEyMfKW+9Fl3vv4UZcdMRUljjOeW/XLIwRCNSEZLIB4AiDtw 1Zj5L7x+NmO80LcMp2FVa5KHrHmKi6TOERZwMrGbn05Vi8X7SJM9jsD0v+zkyCFa JhTKGS+jhXkYPponi55pr1CG8cNaQFCUvvg7lMHMywpvdWa5T7pTsyXD1anPoDul D8csgODRQE4Qd8rDNUHBE6Dw99L92VsnBQVMjmLn1b49NNx648KUrc4epQUPk89j KAWuoKg9Gx7wx8MJWQSC2wuejFYOcPs6O+gR4HZSVs9Pn7pvCJRDa9PkiN0mt0x9 1h/FCijzs3UUDTzMjpJkwSdFR7iwP5HKbkw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeftdeigeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefogg ffhffvkfgjfhfutgesrgdtreerredttdenucfhrhhomhepfdftohifrghnucfvohhmmhhi nhhsucglkffoufhorfgnfdcuoehimhhsohhprdhphhhpsehrfigvtgdrtghordhukheqne cuggftrfgrthhtvghrnhepudejvdekfeefvdfgveeltedvvedvffevhffhhfetvefgkeeh heetgeetleejffeknecuffhomhgrihhnpehgihhthhhusgdrtghomhdpshhpvggtqdgsrh grihhnshhtohhrmhdrmhgunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomhepihhmshhophdrphhhphesrhifvggtrdgtohdruhhkpdhnsggprhgtph htthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhhtvghrnhgrlhhs sehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id A7C003C006A; Wed, 14 May 2025 04:08:33 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: T8bfaf70c4b144161 Date: Wed, 14 May 2025 09:08:13 +0100 To: internals@lists.php.net Message-ID: <3ae9a6ea-f135-472b-b2bf-e6cd6ebad299@app.fastmail.com> In-Reply-To: References: Subject: Re: [PHP-DEV] Module or Class Visibility, Season 2 Content-Type: multipart/alternative; boundary=8feffb89df464153a8e1f947846e9207 From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") --8feffb89df464153a8e1f947846e9207 Content-Type: text/plain Content-Transfer-Encoding: 7bit On Tue, 13 May 2025, at 16:30, Deleu wrote: > If we consider how GitHub, Composer and Docker Hub works, we can pin a very important aspect of "namespaces": {entity}/{project}. Entity may either be an individual or an organization, but the concept is mostly the same. Although it can be argued that PHP has nothing to do with that, I think that could be a "good-enough" foundation considering the complexity of the subject. While a two-level namespace root for a project is common, it's far from universal. Picking two examples from the first page of "popular packages" on packagist.org, Guzzle's root namespace is one level ("GuzzleHttp\") and the Symfony Console component's root namespace is three levels ("Symfony\Component\Console\"). So I think any module or visibility tied to namespaces would need a way to declare that prefix explicitly, not have the language assume it's a particular length. If we just want namespace visibility, we could use Scala's approach, where the private modifier itself can be qualified: private[\Symfony\Component\Console] class Foo { ... } private[\Symfony] class Bar { ... } If we want modules to have more existence - module-wide declares, optimisation, etc - then we need some way of declaring "this namespace prefix is a module" - a "module" keyword, or "declare_module" function, or something. Those are the lines that Larry and Arnaud were exploring along a while ago - see https://github.com/Crell/php-rfcs/blob/master/modules/spec-brainstorm.md and https://github.com/arnaud-lb/php-src/pull/10 What Michael Morris is talking about is really a completely different concept - it's more like "containers", in the sense of Docker, Kubernetes, etc, where different sections of code can be isolated, and declare classes with conflicting fully-qualified names. I don't think it's what most applications and libraries would want "modules" to be; it's probably best thought of as a completely separate feature. -- Rowan Tommins [IMSoP] --8feffb89df464153a8e1f947846e9207 Content-Type: text/html Content-Transfer-Encoding: quoted-printable
On Tue, 13 M= ay 2025, at 16:30, Deleu wrote:
If we consider how GitHub, Composer an= d Docker Hub works, we can pin a very important aspect of "namespaces": = {entity}/{project}. Entity may either be an individual or an organizatio= n, but the concept is mostly the same. Although it can be argued that PH= P has nothing to do with that, I think that could be a "good-enough" fou= ndation considering the complexity of the subject.

While a two-level namespace root for a projec= t is common, it's far from universal. Picking two examples from the firs= t page of "popular packages" on packagist.org, Guzzle's root namespace i= s one level ("GuzzleHttp\") and the Symfony Console component's root nam= espace is three levels ("Symfony\Component\Console\").

So I think any module or visibility tied to namespaces would nee= d a way to declare that prefix explicitly, not have the language assume = it's a particular length.

If we just want names= pace visibility, we could use Scala's approach, where the private modifi= er itself can be qualified:

private[\Symfony\Co= mponent\Console] class Foo { ... }
private[\Symfony] class Bar= { ... }

If we want modules to have more existe= nce - module-wide declares, optimisation, etc - then we need some way of= declaring "this namespace prefix is a module" - a "module" keyword, or = "declare_module" function, or something. Those are the lines that Larry = and Arnaud were exploring along a while ago - see https://g= ithub.com/Crell/php-rfcs/blob/master/modules/spec-brainstorm.md and&= nbsp;https://gi= thub.com/arnaud-lb/php-src/pull/10

What Mic= hael Morris is talking about is really a completely different concept -&= nbsp;it's more like "containers", in the sense of Docker, Kubernetes, et= c, where different sections of code can be isolated, and declare classes= with conflicting fully-qualified names. I don't think it's what most ap= plications and libraries would want "modules" to be; it's probably best = thought of as a completely separate feature.

--=
Rowan Tommins
[IMSoP]
--8feffb89df464153a8e1f947846e9207--