Skip to content

[Feature Request] Macros #160

@aaronmallen

Description

@aaronmallen

It would be awesome if we could declare macros that simply repeat a signature. Lets say I have two or more methods that do similar things and accept the same arguments:

# Does a thing
#
# @rbs (String | Symbol, ?Hash[String | Symbol, untyped]) -> void
def does_a_thing(foo, bar = {})
  ...
end

# Does a similar thing
#
# @rbs (String | Symbol, ?Hash[String | Symbol, untyped]) -> void
def does_a_similar_ting(foo, bar = {})
  ...
end

It would be nice to be able to do:

# @rbs! macro interned_and_untyped_hash_returning_void: (String | Symbol, ?Hash[String | Symbol, untyped]) -> void

# Does a thing
#
# @rbs interned_and_untyped_hash_returning_void
def does_a_thing(foo, bar = {})
  ...
end

# Does a similar thing
#
# @rbs interned_and_untyped_hash_returning_void
def does_a_similar_ting(foo, bar = {})
  ...
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions