Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127291 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 40FA21A00BC for ; Mon, 5 May 2025 18:08:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1746468365; bh=2g1QzVUKAtNGgEIEUuNJtFycruikrP+Vu8SXdnEdAqs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=EoGpTF+z3EX0qx7o0sFS7UqAmXtx4AN9J0AF0DiuDL0STUAtIaWyWFbnIrmsedHFB JCycoIj10l/3zOCXpbVbfjRaPcbzZ2igYPBoZLWoVu+gxs3T0zG+0ZwT1ewgWwS84L 3HGS28062/LVkCYOcYiPxl4TfNtx5pcA9Bw15Gs8b8j188GgxQRN+518JkCrBXmB95 GjJn1lyNpFHBHrUcDKRaemr8h5IR3H1YrqN1pVOD29em3ZAXFM//cEyk+hdf5ag/bG XzXNT6UVoJyNh2uwj0Ojw0YS1i3+2CLcdWNxCZDu2OqjIMAI6blj951IGcZugPSbJx Z7cH3ITM5BWGQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ED85A180077 for ; Mon, 5 May 2025 18:06:04 +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, 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-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) (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 ; Mon, 5 May 2025 18:06:04 +0000 (UTC) Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-e6e1cd3f451so4042422276.2 for ; Mon, 05 May 2025 11:08:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746468498; x=1747073298; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=2g1QzVUKAtNGgEIEUuNJtFycruikrP+Vu8SXdnEdAqs=; b=fUZFtdb9bGUOihhLUk4A/2wT6MzKwXIJG7odsCI6XhdWFcgDR9Ep6noz8gP9/FEeEL 5BMmoTO/SAOH7/U6LMVe3td1UQ6vZ6OEk43dMQRYIgEujTYQLdca2XsuhJGoJz0SosHg 9bIroisIX2XaUMA4RIe9OyDLxo/nprzPYRvFVr8llp5zA2UxteoXCuNzJT73itGW0GKw Qk6uyhXi93pwz4lvgP7WzGoGRptltHrmqJNCguKZVycBKIxbd9w2RsiZvm8537Y0nr8V QiaQsLNA9BT47DKOCHCVBKCB2HxSxcG7uk17wgqoalQ6+QvPizP2FPyZDI6vpmgR+sLB m+HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746468498; x=1747073298; h=content-transfer-encoding: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=2g1QzVUKAtNGgEIEUuNJtFycruikrP+Vu8SXdnEdAqs=; b=DQgR6yowlQC8536EVa25fEbJ9R53QU05EqrHQ0AWYRGEcZnMrNtTHs9pE4kMOGJoqo gXtcNA/SEl2fF/nESBsD2KZajK1sx7C8YL29TfZ6/I53NCEvltO3IlUZ4l6ja6+Byp0/ gtNH8+5N/tt+iWjxC0s6bJzpKFYzp7YSA2BIC+zZ1VA5ygCKyD6IFNQLaluLraY2ho3I nLoDKFKaJdwiJ9YubKu8BTlCjhQn5kdlpKmlb+CyvoytC7D2Pa3BIxgoI14cB6kN1bql NJ7Pv23OncexvfwSvZor8Jv4X1Cus5IuBtLkHYtTeJrpbdS2Fvsv+6AbqXFIaRyNCfwH 7XBA== X-Gm-Message-State: AOJu0Yx2h5EdH0zwvhz5zistEE8qe54Mx3eh8YJlo08srOG0ibPkMc2t gcSJtKqNg+5qEHioyQhm9mROOBxLciBxYusZTIjTXbuN8NtEDe4XN9WjHP/YuuZ6opxbLNx8kS5 +OA/n1KlzMzV0g1H0CDC5H1GDak0= X-Gm-Gg: ASbGncsPsqODQL0ZWLPtbzYGlhfxINcDf4i+TA+vZEojrXaRx3Ieu30GScuPQ/hJc+E b5MlL804mOORnLOhBC67465EEU2qvIUOw7mtRfWV3dF6fb5Z+FyXQA5kq3weBKGl/Fxglef8ELJ fmAZgpEPzvgs1Y6NQRNMkfHA== X-Google-Smtp-Source: AGHT+IEDjgfu/GgIBYBN5u+If8BoJqNXCuUei/p/plKlE7U/bWbaiQJnxK9Lv43FQAZFR0dEm0HLJGoSY5MNHDVx7Y4= X-Received: by 2002:a05:6902:1882:b0:e72:bd60:9cca with SMTP id 3f1490d57ef6-e757d2e7ff7mr9811151276.23.1746468498343; Mon, 05 May 2025 11:08:18 -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: Mon, 5 May 2025 21:08:06 +0300 X-Gm-Features: ATxdqUFNo9UJ2CqwSk9myfSt6AqwNz4ZamsYuGXkbwI_WMxZGk4HcfqhLpMGtqo Message-ID: Subject: Re: [PHP-DEV] Modules, again. To: Michael Morris Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: edmond.ht@gmail.com (Edmond Dantes) Hello, Michael. Thank you very much for your work. It's very interesting. Let me look at this idea from an architectural perspective. Did I understand correctly from the text that: * Modules control which entities are public and which are not? * During import, we specify which entities we want to bind to which namespa= ce? * Could this solution help with separating Internal and Public classes? In other words, the information about what is public and what is private is part of the module. And the information about how the module is integrated into the project lies outside the module. Could this task be reduced to using `use as`? For example: ```php use \MyClass as MyClass2; ``` This situation is very similar to creating aliases for namespaces, but the difference is that the alias is created not for the code being used, but for the code being loaded. Technically, this is quite possible to implement: 1. We specify that files at a certain path will be loaded into a different namespace. 2. During loading, all namespaces are inserted into the symbol table with the desired alias, as if a person had manually renamed all the modules. But there is one problem here that cannot be solved at all. `PHP` lacks an abstraction over symbols. It doesn=E2=80=99t have a dedicate= d `Class` or `Namespace` type =E2=80=94 strings are used in code for that purpose. And that means any code that tries to load a class using a string constant will break. To solve this, `PHP` would need to introduce a new data type. That=E2=80=99= s not a problem, but it does require an `RFC`. In addition, a new `PSR` for packages and autoloading would be needed. You have a great idea, but I think it requires some groundwork in these areas first. P.S. I consider WordPress the best example of what rapid programming can look like =E2=80=94 and where it can lead. And I don=E2=80=99t hate it. :) Best Regards, Ed