Skip to content

Conversation

@srawlins
Copy link
Member

Since the mixin was introduced, and the class modifiers, we've had some tech debt around our mixins. We have a lot of mixins, and some of them are better suited as interfaces or base classes. In this case, Locatable was a mixin with mostly abstract getters, and one implemented getter. To me this really smelled like it should be an interface.

Turns out, that implemented getter, documentationIsLocal, is only called on Warnable objects (which implemented Locatable). So we can move the getter to Warnable.

Then we can change every case of with Locatable to implements Locatable. Except that the interface isn't even needed on some classes, like Category and Package, so we can just remove the mixin there.

Then a rename. I think it's idiomatic for mixin names to end in "able" like "Locatable," "Warnable," "Namable" to suggest the ability that is mixed in. And it is more idiomatic for an interface to start with "Has" to suggest features that are implemented by an implementing class. But there's nothing hard-and-fast here; I'm open to other naming ideas.

@srawlins srawlins merged commit 6d1aa6f into dart-lang:main Oct 23, 2025
13 checks passed
@srawlins srawlins deleted the has-location branch October 23, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants