Skip to content

Add in &untyped #1622

Open
Open

Description

@sampersand

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

Activity

  1. ParadoxV5 commented on Nov 18, 2023

    @ParadoxV5
    Contributor

    Add a ? prefix to indicate optional block

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

    Possible alternative:

    def foo: () ?{ (...) -> void } -> void

    Where ... eats everything just like in

    def example(...) = 42 # The entire `...` is unused
  2. self-assigned this
    on Nov 20, 2023
  3. soutaro commented on Nov 20, 2023

    @soutaro
    Member

    The proposal makes sense. Will compose a proposal for block syntax updates including this.

  4. added this to the RBS 3.4 milestone on Nov 20, 2023
  5. ParadoxV5 commented on Nov 20, 2023

    @ParadoxV5
    Contributor
    def foo: (&block_type blk) -> void

    The block_type must be a _ToProc (Hah! #1223).

  6. modified the milestones: RBS 3.4, RBS 3.5 on Dec 14, 2023
  7. removed this from the RBS 3.5 milestone on Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions