Open oscar-broman opened 4 years ago
YES, please. It's really good to know if a method is "new" or implements something abstract. Too many times have I removed foo
from A and forgotten to remove the implementation in X
because it didn't have override
.
Having a distinct keyword for implement
helps:
@bishabosha is there something I can do to help make this happen?
Note that we're releasing Scala 3.0 in a few months, so now is not really the best time for throwing in more new features :). In any case, something like that would have to go through the SIP process: https://docs.scala-lang.org/sips/ (but the SIP committee is busy with existing Dotty features for now)
Understood, maybe in a future release then :)
I didn't have 3.0 in mind for this suggestion, since it's in feature freeze last I heard.
linking discussion from https://contributors.scala-lang.org/t/implement-keyword-instead-of-override/4035
A keyword that's similar to
override
, but causes a compiler error if the parent method is implemented. This is good to distinguish overriding from implementing abstract methods.Quite often,
override
is used to make sure the method actually implements an abstract parent method. But if the parent method is actually implemented at a later stage, there's no way to know if something overrides it when the idea was to just implement it.