On Tuesday, March 1st, 2022 at 6:24 PM, Larry Garfield <larry@garfieldtech.com> wrote:
> On Mon, Feb 28, 2022, at 9:49 PM, Saif Eddin Gmati wrote:
>
> > Hello internals,
> >
> > Following up on last years email, I have decided to move along with the
> >
> > Sealed classes RFC after some changes, and put it up for discussion.
> >
> > Previous discussion: https://externals.io/message/114116
> >
> > RFC: https://wiki.php.net/rfc/sealed_classes
>
> Why not "final ... permits" or "final ... for" as options? Effectively what is created here is a final class/classic-thing, but with holes in it. Otherwise, there become questions about why final and sealed have different keywords when they're such similar things.
>
> --Larry Garfield
>
> --
>
> PHP Internals - PHP Runtime Development Mailing List
>
> To unsubscribe, visit: https://www.php.net/unsub.php
I personally see `sealed` and `final` as completely different flags.
one ( `final` ) declares a type as final, therefore, no sub-type can exist at runtime.
while the other ( `sealed` ) declares a type as non-final, with known, limited set of sub-types.
another things to note, is that `final` modifier is currently not supported on traits, and interfaces, and while we could add this, it still feels "wrong" when you see `final interface FooInterface ..` at first glance, making it harder to read the code.
However, i see why people might prefer this option, so if enough people request this, i will add it as a syntax option.
Cheers,
Saif.