Christoph R.
10/24/2003 10:37:00 AM
Dan Doel wrote:
...
> Which version of ruby are you using?
>
> I copied, pasted and got no errors with the mswin32 1.8.0 build.
>
> - Dan
Weird,
I did the same (with yesterdays cvs mswin32 build) and got
the error. IMO it is erroneous Ruby code anyway - maybe the
following snippet is somewhat illuminating.
----
def sum
result = 0
self.each { |*elt| p elt; result += yield(*elt) }
result
end
public :sum
un_mod = [[1,2],[3,4]]
mod = un_mod.clone
def mod.each
super {|e| yield *e }
end
mod.sum { |a,b| b } # runs fine
p "###"
un_mod.sum { |a,b| b } # gives an error.
---
this results in
---
[1, 2]
[3, 4]
"###"
[[1, 2]]
D:/rb75.tmp:3:in `+': nil can't be coerced into Fixnum (TypeError)
from D:/rb75.tmp:3:in `sum'
...
------------
/Christoph
Please send off list mail to
'my_mail@gmy.net'.gsub(/y/,'x')