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

Support auto extending module (via AncestorBuilder) #1555

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tk0miya
Copy link
Contributor

@tk0miya tk0miya commented Oct 1, 2023

In Ruby language, developers need to use both "include" and "extend" to implement mix-in having instance methods and class methods. The auto extending module is a well-known technique to realize it (ex. ActiveSupport::Concern, "extend" call in included block, and so on).

This supports the auto extending modules via modules having "autoextend:..." annotation. The RBS::DefinitionBuilder searches the extended modules from the annotations of the included modules.

This is yet another version of #1503. This modifies RBS::DefinitionBuilder::AncestorBuilder#one_singleton_ancestors to get auto-extending modules.

  • pros
    • Simple feature and simple implementation
  • cons
    • Do not support nested auto-extend (recursively) as ActiveSupport::Concern does.

@tk0miya tk0miya force-pushed the support_auto_extending_modules2 branch from 408dea7 to 878c38f Compare October 1, 2023 05:06
In Ruby language, developers need to use both "include" and "extend" to
implement mix-in having instance methods and class methods.  The auto
extending module is a well-known technique to realize it (ex.
`ActiveSupport::Concern`, "extend" call in `included` block, and so on).

This supports the auto extending modules via modules having
"autoextend:..." annotation.  The `RBS::DefinitionBuilder` searches the
extended modules from the annotations of the included modules.
@tk0miya tk0miya force-pushed the support_auto_extending_modules2 branch from 878c38f to 9e4ee29 Compare October 1, 2023 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant