[#102652] [Ruby master Bug#17664] Behavior of sockets changed in Ruby 3.0 to non-blocking — ciconia@...
Issue #17664 has been reported by ciconia (Sharon Rosner).
23 messages
2021/02/28
[ruby-core:102661] [Ruby master Bug#16514] Documentation mistake for method syntax (splat/array parameter)
From:
usa@...
Date:
2021-02-28 14:37:43 UTC
List:
ruby-core #102661
Issue #16514 has been updated by usa (Usaku NAKAMURA).
Backport changed from 2.5: REQUIRED, 2.6: REQUIRED, 2.7: DONE to 2.5: REQUIRED, 2.6: DONE, 2.7: DONE
ruby_2_6 r67900 merged revision(s) 3c93ed59.
----------------------------------------
Bug #16514: Documentation mistake for method syntax (splat/array parameter)
https://bugs.ruby-lang.org/issues/16514#change-90655
* Author: adamisom (Adam Isom)
* Status: Closed
* Priority: Normal
* Backport: 2.5: REQUIRED, 2.6: DONE, 2.7: DONE
----------------------------------------
Hello,
In the docs for method definition syntax [here](https://github.com/ruby/ruby/blob/master/doc/syntax/methods.rdoc#arrayhash-argument) we find "The array argument must be the last positional argument".
This is, of course, what is shown on the [ruby-lang.org](https://docs.ruby-lang.org/en/2.7.0/syntax/methods_rdoc.html) and [ruby-doc.org](https://ruby-doc.org/core-2.7.0/doc/syntax/methods_rdoc.html) pages on method syntax.
This is not true. Example code (2.7)
``` ruby
def test(val1, *vals, val2)
puts val1, vals, val2
puts "val2: #{val2}"
end
test(3, 4, 5, 6, 7)
# test(3, [4, 5, 6], 7) # this code also works
```
Conclusion: splat/asterisk/array parameters need not be at the end.
I will point out that the documentation for Ruby 2.6.5 has the same apparent documentation mistake. The splat parameter need not go at the end for that version either. I did not test other versions.
I did not find a related issue here on bugs.ruby-lang.org when searching issues for "method syntax", "method.rdoc" or "array parameter", nor did I find a related issue searching the same terms (checking both open and closed issues) on https://github.com/ruby/ruby/pulls
---Files--------------------------------
2844.patch.txt (1.27 KB)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>