Re: Final anonymous classes

From: Date: Tue, 17 Oct 2023 17:31:28 +0000
Subject: Re: Final anonymous classes
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-121357@lists.php.net to get a copy of this message
Hi, Daniil > Personally, I would have instead preferred the much cleaner approach of making *all* anonymous > classes final by default, (preferrably) without offering the option to make them non-final. > > However, I understand that this might be a little bit too restrictive for something that may > have some valid usecases, even if extending anonymous classes currently requires some hack-ish > workarounds with class_alias. > > > All in all, as per the title, I'd just like to add support for final anonymous classes > (new final class {}), without changing any existing semantics. I think the default can be made final. This is because it is difficult to consider such complex "hack" operations as "features supported by the language.." This is even considered a bug of some kind. If more "realistic" code examples were available, the conclusion would be different. At least, as far as I can currently understand, I don't think there is any need to consider backward compatibility with such "hacks". Regards. Saki

« previous php.internals (#121357) next »