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

Proposal: Support auto extending module #1503

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tk0miya
Copy link
Contributor

@tk0miya tk0miya commented Sep 5, 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.

Comment on lines +786 to +787
Module having "autoextend:..." annotation is considered as an auto extending module.
When such auto extending modules are included, the including class will be extended by annotated modules.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to find a better name for the "auto extending module" and its annotation.

lib/rbs/definition_builder.rb Show resolved Hide resolved
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_modules branch from 5cbbf15 to 421fd6d Compare September 5, 2023 11:38
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.

2 participants