[ruby-core:95995] [Ruby master Feature#16378] Support leading arguments together with ...

[email protected]
Newsgroups gmane.comp.lang.ruby.core
Message-ID <redmine.journal-82830.20191127165709.e606775b8b470eb6@ruby-lang.org>
Issue #16378 has been updated by Eregon (Benoit Daloze).


Also I believe `...` could be a good way to do delegation in all versions for lexical cases (the majority):
```ruby
# Could be some constant in a gem
ARGS = RUBY_VERSION < "2.7" ? "*args, &block" : "..."

class_eval <<RUBY
def method_missing(name, #{ARGS})
  if name.to_s.end_with?('?')
    self[name]
  else
    fallback(name, #{ARGS})
  end
end
RUBY
```

And while Redmine doesn't syntax highlight `<<RUBY`, at least GitHub and RubyMine do.

----------------------------------------
Feature #16378: Support leading arguments together with ...
https://bugs.ruby-lang.org/issues/16378#change-82830

* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 2.7
----------------------------------------
I think this is very important, otherwise `...` can be used only very rarely.

For instance, `method_missing` typically want to access the method name like:
```ruby
def method_missing(name, ...)
  if name.to_s.end_with?('?')
    self[name]
  else
    fallback(name, ...)
  end
end
```

See the original feature: https://bugs.ruby-lang.org/issues/16253#note-19.
I think most people expect `def method_missing(name, ...)` to work.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.