-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Re-abstracting" a method #28250
Comments
There is no language-based way to do what you ask for. If the new method didn't have the same signature, then it would effectively become "abstract" again - subclasses that don't override the method won't correctly implement their own interface, which gives a warning. If it has the same signature, that is not a problem, the class has a correctly typed implementation for all its interface's members. (The rule is that a non-abstract class must implement its own interface, which an abstract method doesn't help you with - an abstract method is just a way to add something to the interface without adding it to the class itself). There is no plan to add such a feature to the language. The object model of Dart is fairly simple, and I don't think an addition like this would carry its own weight. I don't think there is an |
I agree with Lasse: the language has easy semantics, and this use case is probably not strong enough to warrant changes to the language. However, I'm generally in favor of improving the communication between the developer and the analyzer/editor. On the one hand this just passes the bucket, but on the other hand this should allow us more flexibility. Also, I'm obviously worried that programs will have annotations all over the place, but we can tackle that problem when we see it. |
A |
I wish there was a way to override an inherited method in such a way that the analyzer would complain if it wasn't reimplemented by further subclasses.
That is:
Right now you can declare an abstract method that overrides a concrete one but both the analyzer and the compiler just ignore it, which is weird:
The text was updated successfully, but these errors were encountered: