[#107867] Fwd: [ruby-cvs:91197] 8f59482f5d (master): add some tests for Unicode Version 14.0.0 — Martin J. Dürst <duerst@...>
To everybody taking care of continuous integration:
3 messages
2022/03/13
[#108090] [Ruby master Bug#18666] No rule to make target 'yaml/yaml.h', needed by 'api.o' — duerst <noreply@...>
Issue #18666 has been reported by duerst (Martin D端rst).
7 messages
2022/03/28
[#108117] [Ruby master Feature#18668] Merge `io-nonblock` gems into core — "Eregon (Benoit Daloze)" <noreply@...>
Issue #18668 has been reported by Eregon (Benoit Daloze).
22 messages
2022/03/30
[ruby-core:107841] [Ruby master Bug#18620] Not possible to partially curry lambda or proc's `call` method
From:
"jeremyevans0 (Jeremy Evans)" <noreply@...>
Date:
2022-03-10 20:21:29 UTC
List:
ruby-core #107841
Issue #18620 has been updated by jeremyevans0 (Jeremy Evans).
Turns out that fixing `Method#arity` is not sufficient for this to work. This is because `Method#curry` does the equivalent `to_proc` on the Method, which also loses the arity. So that also needs work. I submitted a pull request to fix this, though the approach used is suboptimal: https://github.com/ruby/ruby/pull/5640
Note that I'm not sure I would consider this a bug. The pull request fixes this particular use case (Proc#method(:call)), but this curry issue occurs with all Method/Proc objects where the arity is not known. I'll add this as an issue for discussion at the next developer meeting.
----------------------------------------
Bug #18620: Not possible to partially curry lambda or proc's `call` method
https://bugs.ruby-lang.org/issues/18620#change-96772
* Author: waiting_for_dev (Marc Busqu辿)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
You can curry the call method of a regular object:
``` ruby
class Foo
def foo(a, b)
a + b
end
end
Foo.new.method(:foo).curry[1][2] # => 3
```
You can also curry a lambda:
```ruby
lambda { |a, b| a + b }.curry[1][2] # => 3
```
Same for a proc:
```ruby
proc { |a, b| a + b }.curry[1][2] # => 3
```
However, currying a lambda or proc's `call` method doesn't work as expected if not enough arguments are given. Returned error differs in each case:
```ruby
lambda { |a, b| a + b }.method(:call).curry[1][2] # => `block in <top (required)>': wrong number of arguments (given 1, expected 2) (ArgumentError)
```
```ruby
proc { |a, b| a + b }.method(:call).curry[1][2] # => `+': nil can't be coerced into Integer (TypeError)
```
You can however totally apply the function:
```ruby
lambda { |a, b| a + b }.method(:call).curry[1, 2] # => 3
```
```ruby
proc { |a, b| a + b }.method(:call).curry[1, 2] # => 3
```
It prevents using callable objects (responding to `#call`) and lambda/procs in a polymorphic way in regards to currying.
--
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>