Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-06-03 Thread Michael Morris
On Mon, Jun 2, 2025 at 10:40 PM Larry Garfield wrote: > On Mon, Jun 2, 2025, at 3:28 PM, Rowan Tommins [IMSoP] wrote: > > On 02/06/2025 17:57, Larry Garfield wrote: > >> Well, now you're talking about something with a totally separate > compile step, which is not what Michael seemed to be describ

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-06-03 Thread Larry Garfield
On Mon, Jun 2, 2025, at 3:28 PM, Rowan Tommins [IMSoP] wrote: > On 02/06/2025 17:57, Larry Garfield wrote: >> Well, now you're talking about something with a totally separate compile >> step, which is not what Michael seemed to be describing at all. But it >> seems like that would be necessary.

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-06-02 Thread Rowan Tommins [IMSoP]
On 3 June 2025 03:38:58 BST, Larry Garfield wrote: >I fundamentally do not believe pulling arbitrary files into such a structure >is wise, possible, or will achieve anything resembling the desired result, >because *basically no application or library is single-file anymore*. I don't think a

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-06-02 Thread Rowan Tommins [IMSoP]
On 02/06/2025 17:57, Larry Garfield wrote: Well, now you're talking about something with a totally separate compile step, which is not what Michael seemed to be describing at all. But it seems like that would be necessary. There's definitely some crossed wires somewhere. I deliberately left

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-06-02 Thread Larry Garfield
On Mon, Jun 2, 2025, at 9:44 AM, Rowan Tommins [IMSoP] wrote: > On 2 June 2025 14:27:45 BST, Larry Garfield wrote: >>Were we to do that, then the consumer container-loading needs to take any >>potential module-definition into account. Eg, if one class from a module is >>pulled into a container,

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-06-02 Thread Rowan Tommins [IMSoP]
On 2 June 2025 14:27:45 BST, Larry Garfield wrote: >Were we to do that, then the consumer container-loading needs to take any >potential module-definition into account. Eg, if one class from a module is >pulled into a container, all of them must be. You wouldn't containerize "something from

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-06-02 Thread Larry Garfield
On Sun, Jun 1, 2025, at 5:01 PM, Rowan Tommins [IMSoP] wrote: > On 01/06/2025 17:05, Larry Garfield wrote: >> I think there's a key assumption here still that is at the root of much of >> the disagreement in this thread. >> >> Given that code from multiple files is clustered together into a "thing

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-06-01 Thread Rowan Tommins [IMSoP]
On 01/06/2025 17:05, Larry Garfield wrote: I think there's a key assumption here still that is at the root of much of the disagreement in this thread. Given that code from multiple files is clustered together into a "thing" and Given we can use that "thing" to define a boundary for: * name reso

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-06-01 Thread Michael Morris
On Sun, Jun 1, 2025 at 3:18 AM Rob Landers wrote: > This could work! I have a couple of critiques, but they aren’t negative: > > I think I like it. It might be worth pointing out that JavaScript "hoists" > the imports to file-level during compilation — even if you have the import > statement buri

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-06-01 Thread Larry Garfield
On Sun, Jun 1, 2025, at 12:26 AM, Michael Morris wrote: > $myModule = require_module('file/path'); > > or perhaps > > const myModule = require_module('file/path'); > > The module probably should return a static class or class instance, but > it could return a closure. In JavaScript the dynamic

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-06-01 Thread Rob Landers
On Sun, Jun 1, 2025, at 09:17, Rob Landers wrote: > > > On Sun, Jun 1, 2025, at 07:26, Michael Morris wrote: >> Ok, the conversation is getting sidetracked, but I think some progress is >> being made. >> >> I started this latest iteration last year with a thread about introducing >> somethin

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-06-01 Thread Rob Landers
On Sun, Jun 1, 2025, at 07:26, Michael Morris wrote: > Ok, the conversation is getting sidetracked, but I think some progress is > being made. > > I started this latest iteration last year with a thread about introducing > something similar to the ES module system of JavaScript to PHP. What at

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-31 Thread Michael Morris
Ok, the conversation is getting sidetracked, but I think some progress is being made. I started this latest iteration last year with a thread about introducing something similar to the ES module system of JavaScript to PHP. What attracts me to this particular model is that it should already be fam

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-31 Thread Alwin Garside
On 30 May 2025, at 21:29, Rowan Tommins [IMSoP] wrote: > > On 30 May 2025 19:21:08 BST, Alwin Garside wrote: >> In the example above, I image calling or extending the `Foo::bar()` method >> from somewhere outside the `Acme` namespace would trigger an E_USER_WARNING >> or E_USER_NOTICE. The war

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-30 Thread Rowan Tommins [IMSoP]
On 30 May 2025 19:21:08 BST, Alwin Garside wrote: >In the example above, I image calling or extending the `Foo::bar()` method >from somewhere outside the `Acme` namespace would trigger an E_USER_WARNING or >E_USER_NOTICE. The warning/notice could then be suppressed when explicitly >overridin

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-30 Thread Alwin Garside
On 30 May 2025, at 18:38, Rowan Tommins [IMSoP] wrote: > > On 30 May 2025 08:57:34 BST, Rob Landers wrote: >> >> I’m starting to think that maybe modules might be a bad idea; or at least, >> class/module visibility. >> >> As an anecdote, I was looking to extract a protobuf encoding library fr

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-30 Thread Rowan Tommins [IMSoP]
On 30 May 2025 08:57:34 BST, Rob Landers wrote: > >I’m starting to think that maybe modules might be a bad idea; or at least, >class/module visibility. > >As an anecdote, I was looking to extract a protobuf encoding library from a >larger codebase and create a separate library for Larry’s Ser

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-30 Thread Rob Landers
On Mon, May 26, 2025, at 21:39, Alwin Garside wrote: > Hey all, > > It took me a while, but I'm finally caught up with this thread, and would > like to give my 2 cents. > > On 25 May 2025, at 23:17, Rowan Tommins [IMSoP] wrote: > > > > On 25/05/2025 21:28, Larry Garfield wrote: > >> Even if

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-26 Thread Alwin Garside
Hey all, It took me a while, but I'm finally caught up with this thread, and would like to give my 2 cents. On 25 May 2025, at 23:17, Rowan Tommins [IMSoP] wrote: > > On 25/05/2025 21:28, Larry Garfield wrote: >> Even if we develop some way such that in Foo.php, loading the class >> \Beep\Boo

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-25 Thread Rowan Tommins [IMSoP]
On 25/05/2025 21:28, Larry Garfield wrote: Even if we develop some way such that in Foo.php, loading the class \Beep\Boop\Narf pulls from /beep/boop/v1/Narf.php and loading it from Bar.php pulls the same class from /beep/boop/v2/Narf.php, and does something or other to keep the symbols separat

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-25 Thread Rowan Tommins [IMSoP]
On 25/05/2025 09:27, Rob Landers wrote: Here are my thoughts, but first some vocabulary: - direct dependency: a package that is used by the current package - exported dependency: a direct dependency that can be used outside the current package - peer dependency: an indirect dependency on another

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-25 Thread Larry Garfield
On Sat, May 24, 2025, at 4:18 PM, Rowan Tommins [IMSoP] wrote: >>I assume that it will be up to a dependency resolver (either composer or >>something else) will need to figure out which direct dependencies to "hoist" >>up and provide a compatible version between the two packages. > > I see this

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-25 Thread Rob Landers
On Sat, May 24, 2025, at 23:18, Rowan Tommins [IMSoP] wrote: > On 24 May 2025 14:11:57 BST, Rob Landers wrote: > >My only concern is how this would be handled in the class tables. Right now, > >\AlicesCalendar\Monolog\Logger and \BobsDocs\Monolog\Logger would be > >considered entirely different

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-24 Thread Rowan Tommins [IMSoP]
On 24 May 2025 14:11:57 BST, Rob Landers wrote: >My only concern is how this would be handled in the class tables. Right now, >\AlicesCalendar\Monolog\Logger and \BobsDocs\Monolog\Logger would be >considered entirely different types -- as in, not compatible. So if >AlicesCalendar returns a type

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-24 Thread Rob Landers
On Sat, May 24, 2025, at 11:34, Rowan Tommins [IMSoP] wrote: > > > Hi Michael, > > I'm going to skip over all the details about the autoloader for now, because > I think they're going deep into implementation details, and I want to focus > on the same top-level design as my previous email. >

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-24 Thread Rowan Tommins [IMSoP]
Hi Michael, I'm going to skip over all the details about the autoloader for now, because I think they're going deep into implementation details, and I want to focus on the same top-level design as my previous email. On 23 May 2025 02:27:41 BST, Michael Morris wrote: >Bobs docs needs an old

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-22 Thread Michael Morris
On Thu, May 22, 2025 at 4:29 PM Rowan Tommins [IMSoP] wrote: > On 22/05/2025 12:09, Michael Morris wrote: > > >> I've tried several times to explain why I think Linux containers are a >> good analogy; I'm not sure if you didn't understand, or just didn't agree, >> so I don't know what else I can

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-22 Thread Rowan Tommins [IMSoP]
On 22/05/2025 12:09, Michael Morris wrote: I've tried several times to explain why I think Linux containers are a good analogy; I'm not sure if you didn't understand, or just didn't agree, so I don't know what else I can say. I have no disagreement with that, but it's an implement

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-22 Thread Michael Morris
On Wed, May 21, 2025 at 8:27 AM Rowan Tommins [IMSoP] wrote: > > So if we can come up with a solution where only the WordPress plugins need > to be changed, and you can use whatever dependencies you want without > waiting for them to be changed to a new way of working, is that not a good > thing?

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-21 Thread Hammed Ajao
On Tue, May 13, 2025, 9:32 a.m. Deleu wrote: > Hi! > > It's been a few days since I wanted to send this email to internals, but > real life has been a bit chaotic so I apologize if it comes off as if I > didn't research the archives enough. I glossed over the Module conversation > from 10 months

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-21 Thread Rowan Tommins [IMSoP]
On 21 May 2025 13:26:27 BST, "Rowan Tommins [IMSoP]" wrote: > >My understanding of the example is that there are two WordPress plugins, which >want independent sets of Composer dependencies. There might be 20 different >Composer packages used by each plugin, but those packages don't need any

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-21 Thread Rowan Tommins [IMSoP]
On 21 May 2025 10:20:19 BST, Michael Morris wrote: >I'll stop you there. You are deliberately misrepresenting what I wrote and >even a cursory glance at it makes that clear. You are not trying to be >constructive in any way, you're trolling. I'm sorry you got that impression. I can assure you

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-21 Thread Michael Morris
On Wed, May 21, 2025 at 7:23 AM Deleu wrote: > > > On Tue, May 20, 2025 at 11:08 AM Michael Morris > wrote: > >> The Problem: Interoperability. >> >> That's really it. >> > > I think this is why Rowan keeps telling you to call or compare this with > "Containers" and not modules. > Which is why

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-21 Thread Deleu
On Tue, May 20, 2025 at 11:08 AM Michael Morris wrote: > The Problem: Interoperability. > > That's really it. > I think this is why Rowan keeps telling you to call or compare this with "Containers" and not modules. When I opened this thread, my interest was in bundling multiple files all at once

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-21 Thread Michael Morris
On Tue, May 20, 2025 at 6:18 PM Rowan Tommins [IMSoP] wrote: > > > On 20 May 2025 15:04:49 BST, Michael Morris wrote: > >The Problem: Interoperability. > > > >That's really it. Scenario > >Alice provides whatchamacallit A that depends on other whatchamacallit D > to > >work. > >Bob provides wha

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-20 Thread Rowan Tommins [IMSoP]
On 20 May 2025 15:04:49 BST, Michael Morris wrote: >The Problem: Interoperability. > >That's really it. Scenario >Alice provides whatchamacallit A that depends on other whatchamacallit D to >work. >Bob provides whatchamacallit B that also depends on D. >Charles is using A and B. >D gets update

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-20 Thread Michael Morris
The Problem: Interoperability. That's really it. Scenario Alice provides whatchamacallit A that depends on other whatchamacallit D to work. Bob provides whatchamacallit B that also depends on D. Charles is using A and B. D gets updated with a new incompatible API to its prior version. Alice publi

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-15 Thread Rob Landers
On Thu, May 15, 2025, at 10:35, Rob Landers wrote: > On Thu, May 15, 2025, at 10:11, Rowan Tommins [IMSoP] wrote: >> >> >> 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 >> >class allowed with a given name. Name

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-15 Thread Rob Landers
On Thu, May 15, 2025, at 10:11, Rowan Tommins [IMSoP] wrote: > > > 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 > >class allowed with a given name. Names of classes are global. I don't think > >this has to be the

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-15 Thread 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 class >allowed with a given name. Names of classes are global. I don't think this has >to be the case, though. Different languages take different approaches to this. >Fo

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-14 Thread Rowan Tommins [IMSoP]
On 14 May 2025 21:50:25 BST, Michael Morris wrote: >Container, module, block, package, plugin, domain, division, fraction, >lump, branch, sliver, splinter, constituent or whatever the hell else you >call it, I don't care. I know you think I'm just being pedantic about names, but what I was tr

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-14 Thread Rob Landers
On Wed, May 14, 2025, at 16:57, Rowan Tommins [IMSoP] wrote: > > > On 14 May 2025 14:24:57 BST, Michael Morris wrote: > >Well, it's what Go calls "modules". It's confusing because I was being > >truthful, not snarky, when I said "Ask 10 programmers for the definition of > >module and expect 12

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-14 Thread Michael Morris
On Wed, May 14, 2025 at 10:57 AM Rowan Tommins [IMSoP] wrote: > > I don't know much about Go, but at a glance it uses a similar model to > JavaScript and Python where *classes don't have a universal name*, the > names are always local. That's not a different kind of module, it's a > fundamentally

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-14 Thread Rowan Tommins [IMSoP]
On 14 May 2025 14:24:57 BST, Michael Morris wrote: >Well, it's what Go calls "modules". 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." I'm self trained, so I expect to get my >terms wrong from time

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-14 Thread Rob Landers
On Wed, May 14, 2025, at 15:24, Michael Morris wrote: > > > On Wed, May 14, 2025 at 4:08 AM Rowan Tommins [IMSoP] > wrote: >> __ >> >> What Michael Morris is talking about is really a completely different >> concept - it's more like "containers", in the sense of Docker, Kubernetes, >> etc, w

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-14 Thread Michael Morris
On Wed, May 14, 2025 at 4:08 AM Rowan Tommins [IMSoP] wrote: > > 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 c

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-14 Thread Rowan Tommins [IMSoP]
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 argu

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-13 Thread Michael Morris
On Tue, May 13, 2025 at 11:31 AM Deleu wrote: > Hi! > > This would allow public, private and protected classes in a way that I > believe to be useful for the large ecosystem that surrounds Composer. From > my extremely limited understanding of the engine, I think the easy/natural > step would be

Re: [PHP-DEV] Module or Class Visibility, Season 2

2025-05-13 Thread Alexandru Pătrănescu
On Tue, May 13, 2025, 18:35 Deleu wrote: > Hi! > > It's been a few days since I wanted to send this email to internals, but > real life has been a bit chaotic so I apologize if it comes off as if I > didn't research the archives enough. I glossed over the Module conversation > from 10 months ago

[PHP-DEV] Module or Class Visibility, Season 2

2025-05-13 Thread Deleu
Hi! It's been a few days since I wanted to send this email to internals, but real life has been a bit chaotic so I apologize if it comes off as if I didn't research the archives enough. I glossed over the Module conversation from 10 months ago and the one that recently surfaced and after deeply th