-
Notifications
You must be signed in to change notification settings - Fork 200
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
The base
modifier is contagious, even if you don't want it to.
#2908
Comments
Sounds like the job could be handled by a lint that kicks in if a declaration has In this situation, it is probably an improvement to change |
Maybe that is the answer: Don't mark these declarations as We can then consider adding a modifier later, or an annotation if we don't think it's important that it's in the language. (And, to be honest, it's only the base-subtypes-must-be-base requirement that stopped me from declaring |
We discussed this general area early on. There was a lot of focus on the idea that |
I don't want So this is a request for another modifier. And I can see that unless there turns out to be a large public demand for it, it's unlikely to happen. |
I'm adding modifiers to platform classes.
I'm generally adding
base
to things likeSetBase
,ListMixin
orUnmodifiableListView
because they are not intended as interfaces to implement. (If you ever want to doimplements SetBase
, someone missed a point somewhere, either you or someone whose code you need to interact with. Just useimplements Set
.)However, since
base
makes every subclass not have an implementable interface, I cannot do something like:and allow someone to
implements SuperSet
.Instead I have to do
That's not necessarily bad, but it does force a separation into interface and implementation that Dart has so far not forced.
The obvious alternative is to not make
SetBase
bebase
. It's not dangerous if someone implementsSetBase
, it's just unnecessary and confusing.What would work better is the ability to make
SetBase
not introduce an implementable interface, but not force it to be inherited by subclasses.Strawman: A modifier called "nointerface" which allows the same direct operations as
base
(aka: not implement), but does not force subtypes to bebase
orfinal
.Because sometimes that's all you want to say: "This type is not important, always use the supertype instead, or an important subtype."
The text was updated successfully, but these errors were encountered: