rbs icon indicating copy to clipboard operation
rbs copied to clipboard

Better support for singleton types in modules

Open soutaro opened this issue 2 years ago • 0 comments

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
  1. Allow having singleton types in module self type constraints
  2. Let singleton(SoftDeletable) < singleton(ActiveRecord::Base) (but what to do at the module context?)

soutaro avatar May 16 '23 07:05 soutaro