Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127306 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 2A7291A00BC for ; Wed, 7 May 2025 18:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1746641803; bh=mg6RVt3FN5UmZEzrrD/5uHKgrftuMw15ZQOpAlHbB/k=; h=References:In-Reply-To:From:Date:Subject:To:From; b=BMxO1i2jSMsXCPHIIl5YAXInwT4wQUTTQGXY2hp2Qi6u2TiumUKzuT52ZMP8DYRb4 MYPNAngncU9bGFzA1W04icja3QNl5WpPHQQXFkPNnDK6IeJzMUVmU0VglDZNPQcEgS FaT3oz/d1ZKwUMM6HJNcwwyqjAPCC+CJDXeWr1qmOhE6zrrCBExZONZ7R3lW/tL9Sj QnCMvkVgoe5jJ7R8ZWquMvhPmdupfgvLF+t85i1Mwcp3LUQoSI8XJvAxs9sW7jDqla Ui8KPhFd0sbLwV2396DwPKWBpQ4jpCEAlKNKh9LVNWX7W7hyXExsexqwPqXGJNI4Xl YeIfv1+U5/hRA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 62EF718006A for ; Wed, 7 May 2025 18:16:42 +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-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) (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, 7 May 2025 18:16:42 +0000 (UTC) Received: by mail-qv1-f46.google.com with SMTP id 6a1803df08f44-6ecfbf1c7cbso3426946d6.2 for ; Wed, 07 May 2025 11:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746641935; x=1747246735; darn=lists.php.net; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=CKY/nuhhKaFs21Riu4Dj0PxNmaE2ohwhghI9drFymus=; b=COw4Tj+ZEb0afnvTXUd1vk0eVD4E0Sz2f3SsIfFuCPVusKL4QHlKc+irkm5Pe6LcAK 02EeymkCsiEO33CVWVl3cmxzAPOWe+R9KsziNCyOi/ZbOO+Qpnw/TLneuH1HC7Esb/tN 72PfSxloMssstKSX2eZG/hBGfiIoOqtEvQpuRuK/f78eEQFKAfg4Sso2mYDBQF4Hb2Q+ IuDar+YjG3AGOFtVp3qxglCp+F0LhK27RiPkhuIU/PcSvekDCI/JsbR6cTjcfvCqVe+n RiwmZfjsvE3AK1a9nhp4LqXbm/+0FCgDlQrbeZSKsIdOmapdrEKt/8nWIL7G5E4HY85G o0Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746641935; x=1747246735; h=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=CKY/nuhhKaFs21Riu4Dj0PxNmaE2ohwhghI9drFymus=; b=Vzyo4/DPvdgNMRLK1M9bj+scgCl0Q8XK9ajTnux6CGI3QYGmP/6DFXQV3ULUaFpsE8 //AUpV01BMsB4Jik+EYFEsJXYqeWauw6JzyG3MkQiaGoDQpRm3WIyfNpSnaKhZfOVUsr Te3gDMUmnqkFKbpC6rxmBpgRd5UkBKgrQggyMhKuuNSm0ebc44kJHFQ7YOJvNtg7nWGU l9n6BTShFmI2FDkSKCuZ5nEL0v8V3AN9fZT/GE4V6I9Nlgbau+9AlWMdiqv9SRhI2zbH DnHxL6fYfpZr7KrHDr65Lhbcf7P4NGm/CLlHyxquKst1xrCi4wiXdiiMH9v9FLNQJfoe IBQA== X-Gm-Message-State: AOJu0YwFzDEEbQTMKO8rwfMmevom+dgeVIkg2yWEXC3qADj/J2ODITNZ zbU/581HXsVFsXRWLSFmowJSfh+kpHbPi65aNS5Oo2wnR3mJDzv5FH8xzTgq9hcLji8vIN4hStG a1217l27Q6/m3QbSWJgJZNG14/sD6eA== X-Gm-Gg: ASbGnctlTyjkhGKFUhUa/EVKROYdpGgeIsKBrQXdjrc7+0MSd8oDH5N/VnyD8Mhv/61 vyE1SnnznVtVpuPGGuapSqQkPSmtAxgV9SbE4oiqMaiuSZZY/VcxJXtlusl0f83cvhx8GSKMV+v pdk7N6bH4lFy9PnPBgjahkMMWsLE6E32Xi0JRE2Q7Pw3dw7D+IsaLp X-Google-Smtp-Source: AGHT+IESWW4bbFPBgyP07MFp4TFAOWCgWglw9JMP3zA9i+/Tz8XjzNX2jdZW0zSouyQeyYUwN7DFqKFCk1byA6IERNc= X-Received: by 2002:a05:620a:29c3:b0:7c5:4a3a:bc12 with SMTP id af79cd13be357-7caf73b6e3cmr586726585a.32.1746641934770; Wed, 07 May 2025 11:18:54 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <9cbbe803-5fd1-4011-b42e-033d4ede3fe9@app.fastmail.com> <15a33d20-47c1-443e-aafd-f39bd8f367c1@app.fastmail.com> <4e0bc5b1-48af-4b4c-9d75-3d20245824f2@app.fastmail.com> In-Reply-To: <4e0bc5b1-48af-4b4c-9d75-3d20245824f2@app.fastmail.com> Date: Wed, 7 May 2025 14:18:44 -0400 X-Gm-Features: ATxdqUEdgGFB2VX9gCpB1z896fxVenx4ug9eGbbQ_UcqgihFSr3gXTFFDirh4Zg Message-ID: Subject: Re: [PHP-DEV] Modules, again. To: PHP internals Content-Type: multipart/alternative; boundary="0000000000001265f706348fc476" From: tendoaki@gmail.com (Michael Morris) --0000000000001265f706348fc476 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, May 7, 2025 at 10:59=E2=80=AFAM Larry Garfield wrote: > > So it's not really giving private symbols. It's not even blocking access > to anything, since it can still just be included or autoloaded. What > you're proposing is really just an optional loading facade (the real kind > of facade) that lets you pull random symbols into a separate symbol table= , > accessed via separate syntax. (Either a class-like > AnalyzerModule::Analyzer, or use-require.) > > Putting aside for the moment the question of whether that is a good idea > or not, it is definitely not "modules" in any typical sense. I really > don't think calling it "modules" is doing your proposal any favors, as it= 's > just leading to confusion. What you're describing is a name-mangling > facade, or symbol table facade, or something like that. (I don't know th= at > there is a standard name.) > > I strongly recommend you recast your terminology around that, rather than > "modules." That would remove a lot of confusion and allow people to revi= ew > and respond to the idea you're actually proposing, now what they think a > "module" should be. > > --Larry Garfield > No proposal that replaces or even significantly alters how require et al works will be taken seriously, much less gain traction. As long as a package has PHP files that require can parse then clever users can direct require the files of a package distributed this way. The only way to stop it is to truly make files meant to be used with this unreadable to require - and the simplest way to do that is to assume code first and drop support for in these files. I'm in favor of that since I believe the engine can parse the files faster because it should simplify the token parsing process quite a bit. But I don't think a majority, much less the required supermajority would be in favor of such a change, at least not without other compelling reasons. Rather than fight the co-existence with require I think it would be better to harness and work with it. This would also make the changeover easier. As for the point of whether this counts as a module - Ask 10 programmers what a module is and expect 12 different answers. I'm patterning this on the module pattern used in JavaScript. I'm sorry if that doesn't meet your definition of module. I am open to any other name - component? library? Calling it a module until a better name can be found will have to do. But I'm not going to insult my own proposal by calling it "name-mangling facade= " Part of the problem is PHP deals with code on a per file basis, not on a per directory one. Speaking of facades, the PSR-4 loading recommendation of organizing classes puts a module/package facade onto PHP, but it in no way ever has worked that way. Modules and Packages traditionally do work on the directory level, but how do you affix such to a language that has never had it and prevent older mechanisms of the language, such as require, from doing an end run. This problem hasn't been solved for years for a reason - it's not simple. It is an easy one to give up on, as most have. I'm just too stupid to give up I suppose. --0000000000001265f706348fc476 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Wed, May 7, = 2025 at 10:59=E2=80=AFAM Larry Garfield <larry@garfieldtech.com> wrote:

So it's not really giving private symbols.=C2=A0 It's not even bloc= king access to anything, since it can still just be included or autoloaded.= =C2=A0 What you're proposing is really just an optional loading facade = (the real kind of facade) that lets you pull random symbols into a separate= symbol table, accessed via separate syntax.=C2=A0 (Either a class-like Ana= lyzerModule::Analyzer, or use-require.)

Putting aside for the moment the question of whether that is a good idea or= not, it is definitely not "modules" in any typical sense.=C2=A0 = I really don't think calling it "modules" is doing your propo= sal any favors, as it's just leading to confusion.=C2=A0 What you'r= e describing is a name-mangling facade, or symbol table facade, or somethin= g like that.=C2=A0 (I don't know that there is a standard name.)

I strongly recommend you recast your terminology around that, rather than &= quot;modules."=C2=A0 That would remove a lot of confusion and allow pe= ople to review and respond to the idea you're actually proposing, now w= hat they think a "module" should be.

--Larry Garfield

No proposal that repla= ces or even significantly alters how require et al works will be taken seri= ously, much less gain traction. As long as a package has PHP files that req= uire can parse then clever users can direct require the files of a package = distributed this way. The only way to stop it is to truly make files meant = to be used with this unreadable to require - and the simplest way to do tha= t is to assume code first and drop support for <?php ?> in these file= s. I'm in favor of that since I believe the engine can parse the files = faster because it should simplify the token parsing process quite a bit. Bu= t I don't think a majority, much less the required supermajority would = be in favor of such a change, at least not without other compelling reasons= .

Rather than fight the co-existence with require = I think it would be better to harness and work with it. This would also mak= e the changeover easier.

As for the point of wheth= er this counts as a module - Ask 10 programmers what a module is and expect= 12 different answers.=C2=A0 I'm patterning this on the module pattern = used in JavaScript. I'm sorry if that doesn't meet your definition = of module. I am open to any other name - component? library?=C2=A0 Calling = it a module until a better name can be found will have to do.=C2=A0 But I&#= 39;m not going to insult my own proposal by calling it "name-mangling = facade"

Part of the problem is PHP deals with= code on a per file basis, not on a per directory one. Speaking of facades,= the PSR-4 loading recommendation of organizing classes puts a module/packa= ge facade onto PHP, but it in no way ever has worked that way.=C2=A0 Module= s and Packages traditionally do work on the directory level, but how do you= affix such to a language that has never had it and prevent older mechanism= s of the language, such as require, from doing an end run.

This problem hasn't been solved for years for a reason - it= 9;s not simple. It is an easy one to give up on, as most have. I'm just= too stupid to give up I suppose.
=C2=A0
--0000000000001265f706348fc476--