Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do command does not pass rest arguments to the passed block #4660

Closed
andrasio opened this issue Feb 27, 2022 · 2 comments · Fixed by #4798
Closed

do command does not pass rest arguments to the passed block #4660

andrasio opened this issue Feb 27, 2022 · 2 comments · Fixed by #4798
Labels
🐛 bug Something isn't working investigate this requires investigation
Milestone

Comments

@andrasio
Copy link
Member

andrasio commented Feb 27, 2022

Describe the bug

The help information for do states that the rest arguments to it will be passed to the block parameter.

do block ...rest

I'm not sure how to use the arguments passed from the block. I'd expect this to work (unless I'm missing something)

How to reproduce

do {|text| echo $text} "hola"

Expected behavior

do {|text| echo $text} "hola"

should print in the screen hola

Screenshots

No response

Configuration

No response

Additional context

No response

@andrasio andrasio added 🐛 bug Something isn't working investigate this requires investigation labels Feb 27, 2022
@fdncred
Copy link
Collaborator

fdncred commented Feb 27, 2022

related #4522

@hustcer hustcer added the 0.60 label Mar 4, 2022
@sophiajt
Copy link
Contributor

sophiajt commented Mar 4, 2022

This one is going to need a bit more work in the type system. Right now there isn't a way to say "a block with an arbitrary signature" that gets filled in later. All the other commands already know how many parameters they need, and we want to check those.

> do {|text| echo $text} "hola"
Error: nu::parser::parse_mismatch (link)

  × Parse mismatch during operation.
   ╭─[entry #1:1:1]
 1 │ do {|text| echo $text} "hola"
   ·     ───┬──
   ·        ╰── expected 0 block parameter
   ╰────

@hustcer hustcer added this to the v0.60.0 milestone Mar 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working investigate this requires investigation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants