ruby / ruby/rbs

Add in `&untyped`

Open
#1,622 3 comments 1 reaction 1 assignee View on GitHub

@soutaro is already working on this.

Since Nov 20, 2023.

Dominant language
Ruby
Stars
2.2k
Forks
256
Avg merge
6d 17h
Merged PRs (30d)
37

Description

Currently, *untyped and **untyped can be used to accept any amount of any type of positional and keyword arguments. However, there's no way to accept a block of any type:

def foo: () { (*untyped, **untyped) -> untyped } -> void

indicates that the block doesn't accept block parameters itself. To fix this, you need to do

def foo: () { (*untyped, **untyped) { (*untyped, **untyped) -> untyped } -> untyped } -> untyped

But that block also needs a block itself, etc. ad nauseum. So, my proposal is to add in &untyped syntax, eg def foo: (&untyped) -> void. (This syntax also allows the possibility of naming the blocks—&untyped foo, and might allow for naming block variables themselves, such as: def yield_ten: (&block) { (Integer) -> void } -> void

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.