* [ruby-core:97527] [Ruby master Bug#12671] Hash#to_proc result is not a lambda, but enforces arity
[not found] <redmine.issue-12671.20160812012555.286@ruby-lang.org>
@ 2020-03-16 13:45 ` mame
2020-07-27 20:14 ` [ruby-core:99361] " marcandre-ruby-core
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: mame @ 2020-03-16 13:45 UTC (permalink / raw)
To: ruby-core
Issue #12671 has been updated by mame (Yusuke Endoh).
This ticket was briefly discussed at today's dev meeting, and matz said that the result of Hash#to_proc should be a lambda.
----------------------------------------
Bug #12671: Hash#to_proc result is not a lambda, but enforces arity
https://bugs.ruby-lang.org/issues/12671#change-84683
* Author: headius (Charles Nutter)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
```
$ ruby23 -e 'pr = {foo:1}.to_proc; puts pr.lambda?; pr.call rescue puts $!; pr.call(1, 2) rescue puts $!'
false
wrong number of arguments (given 0, expected 1)
wrong number of arguments (given 2, expected 1)
```
I believe it should be marked as a lambda, since it enforces arity.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:99361] [Ruby master Bug#12671] Hash#to_proc result is not a lambda, but enforces arity
[not found] <redmine.issue-12671.20160812012555.286@ruby-lang.org>
2020-03-16 13:45 ` [ruby-core:97527] [Ruby master Bug#12671] Hash#to_proc result is not a lambda, but enforces arity mame
@ 2020-07-27 20:14 ` marcandre-ruby-core
2020-07-28 18:30 ` [ruby-core:99368] " eregontp
2020-07-28 18:42 ` [ruby-core:99369] " eregontp
3 siblings, 0 replies; 4+ messages in thread
From: marcandre-ruby-core @ 2020-07-27 20:14 UTC (permalink / raw)
To: ruby-core
Issue #12671 has been updated by marcandre (Marc-Andre Lafortune).
Status changed from Closed to Open
Is there a reason why the arity was not fixed to `1` (instead of `-1`)?
----------------------------------------
Bug #12671: Hash#to_proc result is not a lambda, but enforces arity
https://bugs.ruby-lang.org/issues/12671#change-86761
* Author: headius (Charles Nutter)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
```
$ ruby23 -e 'pr = {foo:1}.to_proc; puts pr.lambda?; pr.call rescue puts $!; pr.call(1, 2) rescue puts $!'
false
wrong number of arguments (given 0, expected 1)
wrong number of arguments (given 2, expected 1)
```
I believe it should be marked as a lambda, since it enforces arity.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:99368] [Ruby master Bug#12671] Hash#to_proc result is not a lambda, but enforces arity
[not found] <redmine.issue-12671.20160812012555.286@ruby-lang.org>
2020-03-16 13:45 ` [ruby-core:97527] [Ruby master Bug#12671] Hash#to_proc result is not a lambda, but enforces arity mame
2020-07-27 20:14 ` [ruby-core:99361] " marcandre-ruby-core
@ 2020-07-28 18:30 ` eregontp
2020-07-28 18:42 ` [ruby-core:99369] " eregontp
3 siblings, 0 replies; 4+ messages in thread
From: eregontp @ 2020-07-28 18:30 UTC (permalink / raw)
To: ruby-core
Issue #12671 has been updated by Eregon (Benoit Daloze).
Looking at the commit, should Hash#to_proc use `rb_func_lambda_new()` instead of `rb_func_proc_new()`? (and then `rb_func_proc_new` is unused)
Also it seems confusing that `rb_func_proc_new()` creates a lambda, so using `rb_func_lambda_new()` seems better here.
----------------------------------------
Bug #12671: Hash#to_proc result is not a lambda, but enforces arity
https://bugs.ruby-lang.org/issues/12671#change-86771
* Author: headius (Charles Nutter)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
```
$ ruby23 -e 'pr = {foo:1}.to_proc; puts pr.lambda?; pr.call rescue puts $!; pr.call(1, 2) rescue puts $!'
false
wrong number of arguments (given 0, expected 1)
wrong number of arguments (given 2, expected 1)
```
I believe it should be marked as a lambda, since it enforces arity.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:99369] [Ruby master Bug#12671] Hash#to_proc result is not a lambda, but enforces arity
[not found] <redmine.issue-12671.20160812012555.286@ruby-lang.org>
` (2 preceding siblings ...)
2020-07-28 18:30 ` [ruby-core:99368] " eregontp
@ 2020-07-28 18:42 ` eregontp
3 siblings, 0 replies; 4+ messages in thread
From: eregontp @ 2020-07-28 18:42 UTC (permalink / raw)
To: ruby-core
Issue #12671 has been updated by Eregon (Benoit Daloze).
Proposed fix (simple as it gets): https://github.com/ruby/ruby/pull/3370
----------------------------------------
Bug #12671: Hash#to_proc result is not a lambda, but enforces arity
https://bugs.ruby-lang.org/issues/12671#change-86772
* Author: headius (Charles Nutter)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
```
$ ruby23 -e 'pr = {foo:1}.to_proc; puts pr.lambda?; pr.call rescue puts $!; pr.call(1, 2) rescue puts $!'
false
wrong number of arguments (given 0, expected 1)
wrong number of arguments (given 2, expected 1)
```
I believe it should be marked as a lambda, since it enforces arity.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-28 18:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <redmine.issue-12671.20160812012555.286@ruby-lang.org>
2020-03-16 13:45 ` [ruby-core:97527] [Ruby master Bug#12671] Hash#to_proc result is not a lambda, but enforces arity mame
2020-07-27 20:14 ` [ruby-core:99361] " marcandre-ruby-core
2020-07-28 18:30 ` [ruby-core:99368] " eregontp
2020-07-28 18:42 ` [ruby-core:99369] " eregontp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).