[#111472] [Ruby master Bug#19274] Error installing ruby 3.2.0 on RH 8 — "aalllop (Alberto Allegue) via ruby-core" <ruby-core@...>
Issue #19274 has been reported by aalllop (Alberto Allegue).
5 messages
2022/12/28
[#111508] Data support for versions before 3.2.0 — Eustáquio Rangel via ruby-core <ruby-core@...>
I was wondering that every piece of code (gems, etc) that use the new Data =
3 messages
2022/12/29
[ruby-core:111536] [Ruby master Bug#19286] What should kwargs' arity be?
From:
"Eregon (Benoit Daloze) via ruby-core" <ruby-core@...>
Date:
2022-12-30 15:24:29 UTC
List:
ruby-core #111536
Issue #19286 has been updated by Eregon (Benoit Daloze).
I would guess because `f({a:1,b:2})` used to work before 3.0 and it was passing "one argument", hence arity 1.
Also `def m(*); end` cna be called like `m(a:1,b:2)` and that's clearly one argument on the callee side.
So from the caller point of view kwargs are at most 1 argument.
In general it seems kwargs are considered as 0 (if all optional) or 1 "argument" (from a positional sense), which stems from that history.
----------------------------------------
Bug #19286: What should kwargs' arity be?
https://bugs.ruby-lang.org/issues/19286#change-100899
* Author: matsuda (Akira Matsuda)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.3.0dev (2022-12-28T16:43:05Z master cada537040) +YJIT [arm64-darwin21]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
Hello, guys. It's time for a quick Ruby quiz.
Q: What is this method's arity?
def f(a:, b:)
end
It requires two arguments, hence it should be 2?
Or if we call this method with one argument, the error message says "wrong number of arguments (given 1, expected 0; required keywords: a, b) (ArgumentError)", which means the arity is 0, maybe?
A: The answer is,
$ all-ruby -e 'p method(def f(a:, b:) end).arity'
ruby-2.1.0-preview1 0
...
ruby-2.1.0 0
ruby-2.1.1 -1
ruby-2.1.2 1
...
ruby-3.1.0 1
it's been 1 since 2.1.2. But why 1? Why not 2 nor 0?
I asked this question to the ruby-core people, and ko1's answer was that even he has no idea what the number 1 means.

So I thought it'd be worth asking this question here.
---Files--------------------------------
random_-_ruby-lang_-_Slack.png (40.1 KB)
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- [email protected]
To unsubscribe send an email to [email protected]
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/