Re: Final anonymous classes

From: Date: Tue, 25 Apr 2023 19:34:54 +0000
Subject: Re: Final anonymous classes
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-120130@lists.php.net to get a copy of this message
> Le 25 avr. 2023 à 15:46, Nicolas Grekas <nicolas.grekas+php@gmail.com> a écrit : > >  > Because they conceptually don't create a new type, I wonder if (final) > anonymous classes could be allowed to extend final classes? In order to not > allow hacking around and still create a type with class_alias(), we should > forbid aliasing final anonymous classes IMHO. Then we could have this > discussion about allowing finally anonymous classes to extend final > classes. That'd be really useful in many situations where "final" is > preventing end users from achieving what they want. That would violate the very definition of final, which may be interpreted as “final implementation” as much as “final type”? If your goal is to have a proxy, I wonder whether it would be more appropriate to design a proper way to define a proxy around an existing object, rather than hacking around class inheritance? —Claude

« previous php.internals (#120130) next »