On Mon, Mar 17, 2025, at 12:29, Rowan Tommins [IMSoP] wrote:
> On 17/03/2025 10:37, Alexandru Pătrănescu wrote:
>>> From what I understand of the proposal, the calling code won't know 
>>> anything different based on it being "nested" or "namespaced", it will just 
>>> see a class with a long name with some punctuation in.
>> 
>> The problem for me is not autoloading, but that you can't have the two 
>> classes defined at the same time, while using some other punctuation it 
>> would allow it.
>> I believe that there are other operators that we can use, to allow this.
> 
> 
> Again, I challenge the premise: why would you want to have both defined at 
> the same time?
> 
> Do developers in Java, C#, Kotlin, or Swift complain about this limitation?
> 
> Is there any other language which makes a syntax distinction between "class 
> Foo in namespace Bar" and "class Foo nested in class Bar"?
> 

No, almost no other language I know of seems to make a distinction like PHP 
does. It appears that PHP is unique in this. Does that mean we can learn more 
from these other languages, or less?

I’d be more than happy to put forward a short RFC or poll on the syntax 
choices, as Alexander suggested. Even if this RFC fails, it would be good to 
get a consensus for the future.

>> (As a note, and this might have been discussed already, but I would prefer 
>> to use the term nested class instead of inner class, as in java the inner 
>> classes means non-static classes, and I don't think we should go that way.)
> 100% agree.
> 
> If we did implement something more like "inner classes", a special syntax 
> might make more sense - there would be a very specific relationship between 
> the inner and outer classes. I don't think "has special visibility of 
> members, like a friend-class or file-private feature" needs to be highlighted 
> in that way.
> 

I am inclined to agree with you both on this. Originally I had planned for an 
“outer” and “$outer” that made it more like Java inner classes, but decided to 
leave it to a future RFC if someone ever wanted to implement it. When I first 
started thinking about this RFC, static classes had fairly recently failed, and 
I didn’t want to define what a “static inner class” was. This is part of the 
reason why “static” isn’t allowed as an inner class modifier. This may be a 
potential future RFC if people have need of it.

— Rob

Reply via email to