Better support for singleton types in modules
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Ruby
- Stars
- 2.2k
- Forks
- 256
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 37
Description
Motivating example:
module SoftDeletable : ActiveRecord::Base
module ClassMethods : singleton(ActiveRecord::Base) # New syntax!
end
end
Here, the implementation of SoftDeletable would use ActiveRecord::Base methods from included hook:
module SoftDeletable
included do
scope :deleted, ...
end
end
- Allow having
singletontypes in module self type constraints - Let
singleton(SoftDeletable)<singleton(ActiveRecord::Base)(but what to do at the module context?)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the motivating RBS module example and the requested module self type constraints. Determine the intended behavior for singleton(SoftDeletable) being a subtype of singleton(ActiveRecord::Base), including the module-context question; done means the syntax and subtyping rules are specified and covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100