[ruby-core:96373] [Ruby master Bug#16406] `(lambda_proc << normal_proc).lambda?` should return false

[email protected]
Newsgroups gmane.comp.lang.ruby.core
Message-ID <redmine.journal-83288.20191220083910.d5a60589e2a46a1b@ruby-lang.org>
Issue #16406 has been updated by ko1 (Koichi Sasada).


It was discussed and Matz approved to fix it after Ruby 2.7 release.


----------------------------------------
Bug #16406: `(lambda_proc << normal_proc).lambda?` should return false
https://bugs.ruby-lang.org/issues/16406#change-83288

* Author: alanwu (Alan Wu)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Consider:

```ruby
plus = proc { |a, b| a + b }
mult_two = ->(x) { x * 2 }
composed = mult_two << plus
p [composed. lambda?, composed.call([1, 2])]
```
I think this ought to print `[false, 6]` instead of `[true, 6]`, as the call `composed.call([1, 2])` is clearly not using lambda semantics.
Since `composed = f << g` calls `g` first, I think it makes sense to report `#lambda?` based on whether `g` has lambda semantics.
I have a pull request at https://github.com/ruby/ruby/pull/2729 to make this change.




-- 
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.