On Fri, Apr 21, 2023, at 3:12 PM, Deleu wrote:

> Hey thanks for the reply. I just want to go an extra mile to make my points
> clearer. Please take no negative connotation from what I posted towards
> Composer, PSR-0, PSR-4 or such. I was merely describing things from an
> end-user perspective to bring everything I think about into context.

No offense taken.  A lot of people get confused about the Composer/PSR-4 
relationship, and don't actually understand what Composer is doing, so I just 
wanted to be sure we were all on the same page, explicitly.

> I feel like this all sounds too good to be true/possible because if it were
> easy, it would maybe have been done by now. Even if we park function
> autoloading altogether (for its controversy) and focus just on type
> aliases, the question remains: Why is it not possible to make Type Alias
> the same way that Enum was recently introduced?

I think Tim already answered this effectively.  Enums are, to the engine, 
classes with funny syntax.  They're not a new type, they're classes with some 
extra machinery.  So piggybacking on the class autoloading is trivial.

Type aliases are vastly more complex, because they may or may not exist as 
their own thing, they may (depending on the implementation approach) be 
nestable, they cannot be used everywhere that classes can (I don't think using 
an alias in instanceof would actually work, but it would work with the "is" 
keyword that has been proposed), etc.  They're a fundamentally different beast 
with different syntactic implications.

--Larry Garfield

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to