Skip to content
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

Prefer module methods over Any instance ones #12048

Merged
merged 4 commits into from
Jan 14, 2025

Conversation

JaroslavTulach
Copy link
Member

@JaroslavTulach JaroslavTulach commented Jan 14, 2025

Pull Request Description

While working on #12031 it turned out that Meta.is_a and extension method Any.is_a clash. It makes little sense to treat module's associated type as a value, and as such let's prefer static methods for these associated types. By doing this we refine:

those PRs define preference of Any instance methods over regular types static method ones. E.g. with the integration of this PR the behavior depends on type being associated with a module or being a regular type. That's desirable as regular types often refine instance methods defined on Any while types associated with a module override nothing, but rather serve as a container for module (static) methods.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • All code follows the
    Scala,
    Java,
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.

@JaroslavTulach JaroslavTulach self-assigned this Jan 14, 2025
@JaroslavTulach JaroslavTulach changed the title Prefer module methods over Any instances ones Prefer module methods over Any instances ones Jan 14, 2025
@JaroslavTulach JaroslavTulach changed the title Prefer module methods over Any instances ones Prefer module methods over Any instance ones Jan 14, 2025
Copy link
Member

@Akirathan Akirathan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice docs and tests

CHANGELOG.md Show resolved Hide resolved
@JaroslavTulach JaroslavTulach merged commit aea7f5c into develop Jan 14, 2025
48 checks passed
@JaroslavTulach JaroslavTulach deleted the wip/jtulach/PreferModuleMethods5226 branch January 14, 2025 13:16
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.

3 participants