-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
@override is currently optional. it makes classes longer and more verbose than they need to be. here are two ideas for improving the aesthetics and i'm happy to hear other ideas.
- deprecate
@override
1a. schedule it for removal from the language
pros: it's optional and not needed. deprecating it should be straightforward. removal could be scheduled out indefinitely or 5+ years
cons: it will be harder to tell which methods override superclass methods. maybe there are lsp features like virtual text that could help instead
(this one is my preference because perhaps due to my mechanical engineering background deleting things that are optional is basically a blood sport for people like me.)
- create an
overridekeyword (see swift)
2a. make this keyword required on a method if the superclass has a method with the same name
2b. require removal of the keyword if it exists on a method who has no superclass with a matching method
2c. deprecate@overrideand schedule for removal
pros: one line. explicitly marks overriding methods. make required instead of an optional warning as it currently is.
cons: makes class declaration lines longer. but that's less of an issue with configurable dart format line lengths
i'm personally less inclined to this option because it doesn't provide much value over what we currently have