Skip to content

Untyped block args #1335

@soutaro

Description

@soutaro

AR::Base.scope accepts lambdas, but the type of the lambdas is difficult to describe in RBS.

class AR::Base
  def self.scope: (Symbol, ^(*untyped, **untyped) -> void) -> void
end

The proc type means it can receive any argument and any keywords, while what we want is a proc is required but the type of its arguments is not checked. So, we want to introduce a new syntax for untyped args.

Possible syntax:

class AR::Base
  # ...
  def self.scope: (Symbol, ^(...) -> void) -> void
                | (Symbol) { (...) -> void } -> void

  # ?
  def self.scope: (Symbol, ^(?) -> void) -> void
                | (Symbol) { (?) -> void } -> void

  # untyped
  def self.scope: (Symbol, ^untyped -> void) -> void
                | (Symbol) { untyped -> void } -> void
end

Any other ones?

Metadata

Metadata

Assignees

No one assigned

    Labels

    ReleasedPRs already included in the released versionenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions