Re: Iteration III: Packages (was Re: [PHP-DEV] [Initial Feedback] PHP User Modules - An Adaptation of ES6 from JavaScript)
| From: | Mike Schinkel | Date: | Thu, 04 Jul 2024 01:00:15 +0000 |
| Subject: | Re: Iteration III: Packages (was Re: [PHP-DEV] [Initial Feedback] PHP User Modules - An Adaptation of ES6 from JavaScript) | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-124209@lists.php.net to get a copy of this message | ||
> On Jul 3, 2024, at 8:24 PM, Michael Morris <tendoaki@gmail.com> wrote:
> On Wed, Jul 3, 2024 at 7:52 PM Mike Schinkel <mike@newclarity.net
> <mailto:mike@newclarity.net>> wrote:
> Me personally, the opinions that I do not like are the one-symbol-per file assumption, which is
> also a key issue I have with PSR-4.
>
> That's a PSR-4 issue, not an autoloader one. Autoloaders, even in composer, can use class
> maps to discover which file must be loaded to make the symbol accessible, even if multiple unused
> symbols in that file come along for the ride.
My statement you are commenting on was about
spl_autoload and PSR-4, full stop.
> 2. Symbol encapsulation — Allowing symbols to be hidden from code that should not use them.
>
> Uhm, I'm not formally trained so that one got by me - could you please give an example of
> this? I might have posted one already without realizing it.
Which part? Symbol, or Encapsulation?
If Symbols, that is just the collective name for classes, interfaces, enums, functions, constants
and variables.
If Encapsulation, then that means symbol hiding. PHP offers only limited forms of symbol hiding
with private and protected. Currently it is not possible in PHP to have a
top-level symbol in a namespace — vs. just a function, property or constant enclosed in and as
part of a class — that a developer can disallow other developers from accessing via regular access
methods, e.g. instantiating the class, implementing the interface, using the constant, calling the
function. etc.
Does that answer?
-Mike