Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127289 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 A94851A00BC for ; Mon, 5 May 2025 07:02:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1746428422; bh=weG49u9spHIG7eOKGPvUGIGOP6IuAsvHu3Xlfh6y0ps=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=LxZrlktMxzOc5H/+ZY1nZrynfC6yC5zJy8Har3C2Z8VnDebj49c1MucZGnUUTOmXt NCt6y09R5Bd/C2QdnCofsOadLAt9Qerx7RlaaRSmnUQik8pBezd2R8VC97M+PVnVP9 KLMrnfPM/aADAQtGSZ0llYNZ9f7uIANEsBlcrcKzWLDgCvREEuKZkPeHGx7TRxhAU5 zArMW3A7Ww96SquHSIzr/NkTY6XI9GQ2lvaYKNxduJThqfd9cIE5G8BnU+FS8QM7Jw p0yO+smj3TipZX8gUokzZ3YVpaUwb2wPxsb7P409ILGT5RkWSOsak6UPUZ72MCiSXL BWjFgzjRmHV2w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B7E71180041 for ; Mon, 5 May 2025 07:00:21 +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.5 required=5.0 tests=BAYES_05,DMARC_MISSING, 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 mail1.25mail.st (mail1.25mail.st [206.123.115.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 5 May 2025 07:00:21 +0000 (UTC) Received: from smtpclient.apple (unknown [49.48.218.232]) by mail1.25mail.st (Postfix) with ESMTPSA id 9D7AD60360; Mon, 5 May 2025 07:02:29 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.500.181.1.5\)) Subject: Re: [PHP-DEV] Modules, again. In-Reply-To: <9cbbe803-5fd1-4011-b42e-033d4ede3fe9@app.fastmail.com> Date: Mon, 5 May 2025 14:02:16 +0700 Cc: Larry Garfield Content-Transfer-Encoding: quoted-printable Message-ID: References: <9cbbe803-5fd1-4011-b42e-033d4ede3fe9@app.fastmail.com> To: php internals X-Mailer: Apple Mail (2.3826.500.181.1.5) From: php-lists@koalephant.com (Stephen Reay) > On 5 May 2025, at 04:18, Larry Garfield = wrote: >=20 > On Sun, May 4, 2025, at 2:34 AM, Michael Morris wrote: >> It's been 9 months. Been researching, working on other projects,=20 >> mulling over=20 >> points raised the last time I brought this up. And at the moment I=20 >> don't think=20 >> PHP 8.5 is in its final weeks so this isn't a distraction for that. =20= >> The=20 >> previous discussion got seriously, seriously derailed and I got lost=20= >> even though=20 >> I started it. I'm not going to ask anyone to dig into the archives,=20= >> let's just=20 >> start afresh. >=20 > This proposal requires: >=20 > 1. Every module author to change their coding structure > 2. Every consumer of a package to change their coding structure > 3. Devs to abandon "it just works" autoloading and explicitly import = packages. > 4. Abandoning 16 years of PSR-0/4 file convention in favor of "module = =3D file", which will almost certainly result in multi-thousand-line = files even for clean, well-factored code. >=20 > As I stated in the previous thread, this is a total nonstarter. = Python/Javascript style module definition is simply not compatible with = PHP. It may have been had we gone that way in 2005, but we didn't, and = that ship has long since sailed. >=20 > Any module proposal worth considering can require only the first point = above. Requiring work from a package author to module-ify their code is = fine, though it shouldn't be onerous. But it needs to "just work" with = the rest of the existing ecosystem. This proposal fails at that. >=20 > Arnaud and I spent some time last year exploring a different approach = to modules that requires only trivial changes by package authors, and = none by consumers: >=20 > = https://github.com/Crell/php-rfcs/blob/master/modules/spec-brainstorm.md > https://github.com/arnaud-lb/php-src/pull/10 >=20 > In our case, the main target was performance by giving the opcache = optimizer a larger chunk of code to work with, plus the potential for = namespace-private symbols. Arnaud was able to make it mostly work, and = there was significant potential performance to be had, but it also ran = into some very complex issues very quickly. (Circular dependencies, = modules split across multiple directories, testing, etc.) We largely = haven't gotten back to it as the implementation was very complex and it = wasn't clear if the benefit would be worth it, though I'd still like to = revisit it if possible. >=20 > --Larry Garfield >=20 Just to add my $0.02 as a userland/library developer: I agree with Larry's points - it needs to be transparent for the = *consumers*, and it absolutely needs to align with namespaces, without = any expectation about how symbols relates to files. I personally think initially the goal should be a more minimal approach = that simply introduces the concept of a = module/package/whatever-term-you-like as something that exists, with an = implicit relationship to a namespace. Future RFC's could build on that - even within the same release cycle - = but initially agreeing on a basic way to define "this namespace is also = a " provides a building = block for both language/runtime internal enhancements and external = tooling. Cheers Stephen=20