On Mon, Mar 31, 2025, at 21:45, Rob Landers wrote:
> Hello internals,
> 
> I have significantly revamped the RFC (again). Key changes to the RFC:
> 
> 1. More (realistic) examples,
> 2. Since enums are basically specialized classes, they are allowed to be 
> nested as well (hat tip to Reddit),
> 3. Using backslash as the class separator,
> 4. Proper scoping (and shadowing),
> 5. Nesting is allowed in interfaces and enums as well as classes; but not 
> traits,
> 6. (Hopefully) Clearer wording,
> 7. Nesting in traits, or nested traits, are future scope,
> 8. Nested interfaces are future scope too.
> 
> Some benefits of using \ as a separator:
> 
> - a simple name can refer to nested classes:
> 
> Scope resolution was expanded to treat inner classes within the same class as 
> “in scope.” This provides a more natural usage:
> 
> class Outer {
>   class Inner {}
>   public function foo(Inner $inner) {}
> }
> 
> - Standard “use” statements can alias them:
> 
> use Outer\Inner as Inner;
> 
> But it also has some draw backs:
> 
> - The engine doesn’t know that Outer\Inner is a nested class and autoloaders 
> will have to account for that. It will only ask for Outer\Inner.
> 
> - You cannot simply refer to parent:>Inner, you have to explicitly ask for 
> the parent by name: SomeParentClass\Inner. 
> 
> A draft implementation (which is more of a proof-of-concept) is available on 
> GitHub.

Hello internals,

As it seems that discussion has mostly died down, I'd like to put this towards 
a vote starting on May 1, 2025.

— Rob

Reply via email to