I've often wished for an ADT-style construct while modeling state, but I don't think the `@sealed`, inheritance-based approach from the PEP is actually good. You'd want the final ADT to be a combination of a union and an enum, so it can contain constants too, right?

On Sat, Apr 16, 2022 at 9:51 PM John Hagen <johnthagen@gmail.com> wrote:
The original (superseded) PEP 622 proposed adding a @sealed decorator so that users could define algebraic data types (ADTs) that static type checkers could verify are `match`ed exhaustively:

- https://peps.python.org/pep-0622/#sealed-classes-as-algebraic-data-types

There is a somewhat fairly-upvoted question about ADTs in Python, indicating interest in this area:

- https://stackoverflow.com/questions/16258553

@sealed would be very valuable towards making ADT usage within Python more type-safe. Is there any historical discussion about why @sealed was dropped from the final pattern matching PEP? What would be the next steps needed to push this forward? Would writing a new PEP be the next step?
_______________________________________________
Typing-sig mailing list -- typing-sig@python.org
To unsubscribe send an email to typing-sig-leave@python.org
https://mail.python.org/mailman3/lists/typing-sig.python.org/
Member address: tinchester@gmail.com