Project

General

Profile

Actions

Feature #19370

closed

Anonymous parameters for blocks?

Added by zverok (Victor Shepelev) almost 2 years ago. Updated 11 months ago.

Status:
Closed
Target version:
-
[ruby-core:111988]

Description

Just to clarify: are anonymous parameters delegation is planned to support in blocks?

It would be a nice addition, if it is possible to implement:

# data in form [request method, URL, params]:
[
  [:get, 'https://google.com', {q: 'Ruby'}, {'User-Argent': 'Google-Chrome'}],
  [:post, 'https://gist.github.com', 'body'],
  # ...
].each { |method, *| request(method.to_s.upcase, *) }

...and at the very least, consistent with what the method definition can have.

If they are NOT planned to be implemented, I believe that at least error messages should be made much clearer, because currently, this would happen while running the code above:

no anonymous rest parameter (SyntaxError)

I understand the reason (the request clause doesn't "see" anonymous parameter of the block, and claims that current method doesn't have them), but it looks honestly confusing and inconsistent.


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #19983: Nested `*` seems incorrectClosedActions
Actions

Also available in: Atom PDF

Like1
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0