# [RFC] [Under Discussion] Sealed Classes

- Thread: https://externals.io/message/117173
- Original archive: https://news-web.php.net/php.internals/117173
- Started by Saif Eddin Gmati on 2022-03-01T03:49:30+00:00
- Messages: 4
- RFC: Sealed Class (Declined) — https://externals.io/rfc/sealed_classes.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #117173 — Saif Eddin Gmati — 2022-03-01T03:49:30+00:00

URL: https://externals.io/message/117173#117173

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

Cheers,Saif Eddin Gmati / azjezz
https://void.tn

---

## #117181 — Larry Garfield — 2022-03-01T17:24:54+00:00

URL: https://externals.io/message/117173#117181 · In reply to: #117173

> 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

---

## #117182 — Saif Eddin Gmati — 2022-03-01T17:55:56+00:00

URL: https://externals.io/message/117173#117182 · In reply to: #117181

> 
> 

> > […]

> > […]

> > […]

> > […]

> > […]
> 

> 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
> 

> --
> 

> 
> 

> 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.

---

## #117330 — Saif Eddin Gmati — 2022-03-14T19:58:09+00:00

URL: https://externals.io/message/117173#117330 · In reply to: #117173

> 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
> 

> Cheers,Saif Eddin Gmati / azjezz
> https://void.tn

Hello Internals,

There has been no activity on this thread for awhile, so unless more discussion starts, I plan to open voting in 3 days ( March 17th ).

Regards,

Saif.
