Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127281 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 119CE1A00BD for ; Sun, 4 May 2025 12:15:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1746360822; bh=5zJRUybwrGF8G5UpIkNZJ+3hl1QYQycaqo1Sys9EYxM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=lws38d5/O9UEjUsmhEDbD63osVXKBXLmgjgZgsn22sQj+0AHJH47hGcJvGFxb5lF6 0wVg/PYWBGOsizjvMUwWhvtrcrqzZAHRCwVk/W1HGBMMV6EQGjKLTzPErcx0f60IWG XYhgP4i55fw7nN0v8jhFnuKJr2cL/qgtsXMwoEALJqk55YXOBmvFHXgXg88qZprSU6 RgZ3pGldnbAP0uGPDk3i64vuDr8zJnA6bmgh/SZwybK3FSqXOZGg4V78rLmON12n8P UWFPiJgrX73rJxVyRY/4gycpuW1/oXU5RiQ06VZGXEkefpHGQUgnzi/3vSpZCleUvO JvH671nVI2O/w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 59850180721 for ; Sun, 4 May 2025 12:13:40 +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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, 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 mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) (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 ; Sun, 4 May 2025 12:13:28 +0000 (UTC) Received: by mail-yb1-f172.google.com with SMTP id 3f1490d57ef6-e749a469019so512092276.2 for ; Sun, 04 May 2025 05:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746360942; x=1746965742; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vqVm/a3kVNo/pAY8McXCmd5xo14DEh36f/BeWOnqKhw=; b=lGpYYtzPwsC0tiISKQdjMO/Z5noxOG7Pbl7Q9FALrlJ4RpfbE2T4kWoY/iS4vllWaL vXIGg/Ptx42Ym9sXE2Vo0xFEILMxsl44xfbo1HR06dWbOWzYejBFT8u+lqlqF/mKQPD6 GyPHJx1MN816aYwCRPO9Gxifm1bGpKm3TpqPxhOIDwZnpJyggg3fJhu733zb1bH48uAZ Ma5zSRSKSbIr6VZkDF+cFC5T8wEL0ttIOCe8ue8cjS+Ra/FeBR/yasQHMnYNrJ+UtQFw b+vMqacxrW63ljTE8oYyft2eKjuxzRyzNXHFCs29J9FkU9TtaMdqwxfEzgXpA5f0gvYA N//g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746360942; x=1746965742; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vqVm/a3kVNo/pAY8McXCmd5xo14DEh36f/BeWOnqKhw=; b=g0NY6lW0x2gkzlQB0kbVbADFv6zmQH86cK0XDX1rwrOWyPa4gsdE18zWmCPsf3oPuO PhZgq+TOvjeIesUlpscwvzxoCklm1BHR2+EjyvfsBuqG1kr38Yzav4kvAK4HgLBM0qBI HwbOf/w1L1zmjHQusrxSFTvnWw/28gpDNsrxohpnPdomGSc7YAdEz/kGfj0dOep70vLM 2fqfaK6B65Wa1uHB11gmGIMv5QAkoHtiCYmA7qkBAt2H232LX4+9oYf3pHOXZ2S9E3tS QJ7+XCe88cBpQaQeJtzNVkP++h1LYGFkUzTHIuP3jkauqdJlaz4q/a1oshFA4RlHOvlJ h2Rg== X-Forwarded-Encrypted: i=1; AJvYcCWLAPTWwEFFOchiVI4H+Wc7cjTL5NstzGtSnjHGaxPlByEd3iHRjOsqB70Oz0KlmVC7YV7QSxCiSFY=@lists.php.net X-Gm-Message-State: AOJu0YwpdRVBCAfN+z1LL+9vWROTg9Znr7oP8bgtFD5PrMZri0ndoR6p KtMfLlGjcoFpiddVNv6bDP2qW4UaocRHc4/IQ5W/EEkFWMobRwhYSnGJCPoXTIX72lmUaq8UMwq Qa0/zuB4UnvDqOdotteSuJiJE+t4= X-Gm-Gg: ASbGncuePyEfOQqp8ZhcgcnsRL1e5Cd86yXd9cjaM9fKsNcVTLjarpVKIV3Gyh2PZ1U fO4TOw/CeY9S7r7Wbiun+4hgZKKG0azx6mjO1gSrsS8LB1fDM/2ie54XyFbOJ0w/AdljLezSrJ+ 5VkRyBV7rXaiY1EsIw5wMkXPXSiQs3u6kbL7eVmtG3mwI5DRbwIA8OEQ== X-Google-Smtp-Source: AGHT+IFQ6e4FLnA0ta4rT+vLqWMFdwouFzOaJsBnqhnE+IpmBEu9KlwVW9V7+CdBC6SB/zQKbvo0Xwk31jVaCAsduWY= X-Received: by 2002:a05:690c:288:b0:702:52fb:4624 with SMTP id 00721157ae682-708cebc82f4mr52784187b3.0.1746360941938; Sun, 04 May 2025 05:15:41 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 4 May 2025 09:15:05 -0300 X-Gm-Features: ATxdqUEmoq15CATTINx3W8XcgXvkUgevZC9JDmG4-FvNMdG1OHUnqKR6wD5sL8c Message-ID: Subject: Re: [PHP-DEV] Modules, again. To: Arvids Godjuks Cc: Michael Morris , PHP internals Content-Type: multipart/alternative; boundary="00000000000098112206344e5763" From: deleugyn@gmail.com (Deleu) --00000000000098112206344e5763 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi! On Sun, May 4, 2025 at 8:08=E2=80=AFAM Arvids Godjuks wrote: > > > On Sun, 4 May 2025 at 10:36, Michael Morris wrote: > >> It's been 9 months. Been researching, working on other projects, mulling >> over >> points raised the last time I brought this up. And at the moment I don't >> think >> PHP 8.5 is in its final weeks so this isn't a distraction for that. The >> previous discussion got seriously, seriously derailed and I got lost eve= n >> though >> I started it. I'm not going to ask anyone to dig into the archives, let'= s >> just >> start afresh. >> >> *snip* >> > > I've started reading, saw Wordpress... almost stopped right there, but > decided *okay, this is too rash of me, read further*.... > > "My disappointment is immeasurable and my day is ruined".gif > It ended exactly how my first judging brain wave thought it would go - > this whole thing is about fixing WordPress by changing the language. Plai= n > and simple. > > No. > I think that is a very short sighted statement about the proposal. I have been using PHP for 15 years and I don't know, don't use nor don't care about the Wordpress ecosystem. However, the proposal has immeasurable merits to address many things that have been discussed several times on this list over the years. 1- Private classes. Instead of the currently being discussed nested class declaration with its own set of awkwardness, Modules would allow the declaration of classes that are not globally visible. Regardless of the state of Wordpress, **at first glance** this seems a superior proposal than Nested Class. 2- Friends classes. It has been discussed a couple of times the introduction of class friendship as a way to expose internals of a class only to a specific subset of known / expected classes. This has some foundation in the fact that you don't want to declare public attributes in a global class. With modules, you could declare a class that is not exported to the global scope and use public attributes knowing full well that only classes within your own module will be able to touch them. Again, major props to this proposal over Friends classes. 3- Class autoload vs Function autoload. There have been hundreds of hours spent on discussing function autoloading. I don't quite remember why that is such a hot topic and I also don't remember what it tries to accomplish, but it seems adjacent enough to consider that maybe this proposal could be a door on that realm as well. 4- Familiarity with the Typescript ecosystem. For better or worse, browsers run on Javascript for 3 decades and not even Wasm is fully changing that. This proposal is too familiar from Typescript's import / export system and would help bridge the gap for frontend engineers to better understand the flow of PHP code. ----------- I haven't read (or don't remember) the old discussion. From a superficial look of the proposal, it does seem rather awkward to not go full in with `import / export` keywords, even if it requires a soft reserved keyword. I'm not sure the syntax would require a full hard keyword reservation? Perhaps yield is good enough instead of export, but `use require` does seem rather odd. import ... require (as opposed to import ... from) would also work better-ish. In any case, this threads in bikeshedding space. I guess I'd rather have use .... require anyway than not have it at all, specially since IDEs often end up writing it for us anyway. --=20 Marco Deleu --00000000000098112206344e5763 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi!

On Sun, May 4, 2025 at 8:08= =E2=80=AFAM Arvids Godjuks <= arvids.godjuks@gmail.com> wrote:


On Sun, 4 May= 2025 at 10:36, Michael Morris <tendoaki@gmail.com> wrote:
It's been 9 mon= ths. Been researching, working on other projects, mulling over
points r= aised the last time I brought this up. And at the moment I don't think =
PHP 8.5 is in its final weeks so this isn't a distraction for that.= =C2=A0 The
previous discussion got seriously, seriously derailed and I = got lost even though
I started it. I'm not going to ask anyone to d= ig into the archives, let's just
start afresh.

*snip*
<= /div>

I've started readi= ng, saw Wordpress... almost stopped right there, but decided *okay, this is= too rash of me, read further*....

"My disapp= ointment=C2=A0is immeasurable=C2=A0and my day is ruined".gif
It ended exactly how my first judging brain wave thought it would go - thi= s whole thing is about fixing WordPress by changing the language. Plain and= simple.

No.

<= div>I think that is a very short sighted statement about the proposal. I ha= ve been using PHP for 15 years and I don't know, don't use nor don&= #39;t care about the Wordpress ecosystem. However, the proposal has immeasu= rable merits to address many things that have been discussed several times = on this list over the years.

1- Private classes. I= nstead of the currently being discussed nested class declaration with its o= wn set of awkwardness, Modules would allow the declaration of classes that = are not globally visible. Regardless of the state of Wordpress, **at first = glance** this seems a superior proposal than Nested Class.

2- Friends classes. It has been discussed a couple of times the in= troduction of class friendship as a way to expose internals of a class only= to a specific subset of known / expected classes. This has some foundation= in the fact that you don't want to declare public attributes in a glob= al class. With modules, you could declare a class that is not exported to t= he global scope and use public attributes knowing full well that only class= es within your own module will be able to touch them. Again, major props to= this proposal over Friends classes.

3- Class auto= load vs Function autoload. There have been hundreds of hours spent on discu= ssing function autoloading. I don't quite remember why that is such=C2= =A0a hot topic and I also don't remember what it tries to accomplish, b= ut it seems adjacent enough to consider that maybe this proposal could be a= door on that realm as well.

4- Familiarity with t= he Typescript ecosystem. For better or worse, browsers run on Javascript fo= r 3 decades and not even Wasm is fully changing that. This proposal is too = familiar from Typescript's import / export system and would help bridge= the gap for frontend engineers to better understand the flow of PHP code.<= /div>

-----------

I haven't= read (or don't remember) the old discussion. From a superficial look o= f the proposal, it does seem rather awkward to not go full in with `import = / export` keywords, even if it requires a soft reserved keyword. I'm no= t sure the syntax would require a full hard keyword reservation? Perhaps yi= eld is good enough instead of export, but `use require` does seem rather od= d. import ... require (as opposed to import ... from) would also work bette= r-ish. In any case, this threads in bikeshedding space. I guess I'd rat= her have use .... require anyway than not have it at all, specially since I= DEs often end up writing it for us anyway.

--
Marco Deleu
--00000000000098112206344e5763--