-
Notifications
You must be signed in to change notification settings - Fork 217
Closed
Labels
class-modifiersIssues related to "base", "final", "interface", and "mixin" modifiers on classes and mixins.Issues related to "base", "final", "interface", and "mixin" modifiers on classes and mixins.featureProposed language feature that solves one or more problemsProposed language feature that solves one or more problems
Description
EDITED: After quite a bit of discussion, a proposal based off of the description below (but with some different choices in syntax) has been accepted here.
Users have asked for the ability to prevent a class from being extended (#987) and/or implemented (#704). For exhaustiveness checks in pattern matching, we also need the ability to define a type with a known closed set of subtypes.
The Type Modifiers proposal addresses those. It's an alternative to the earlier Packaged Libraries proposal. The very brief summary is:
- Remove the ability to use a class as a mixin (Do not allow mixing in a class, with migration path #1643).
- Types default to fully permissive as they are today.
- Use
closed
on a class to disable extending it. - Use
base
on a class or mixin to disables its implicit interface. - Use a
switch
modifier on a class or mixin to defines the root of a sealed type family for exhaustiveness checking. It also impliesabstract
.
This issue is to discuss the proposal. Feel free to file other more specific issues too.
kevmoo, samandmoore, ltOgt, Hixie, AlexanderFarkas and 16 moreMajesty22, sullenel and DavidDWiser
Metadata
Metadata
Assignees
Labels
class-modifiersIssues related to "base", "final", "interface", and "mixin" modifiers on classes and mixins.Issues related to "base", "final", "interface", and "mixin" modifiers on classes and mixins.featureProposed language feature that solves one or more problemsProposed language feature that solves one or more problems
Type
Projects
Status
Done