[#23231] What do you think about changing the return value of Kernel#require and Kernel#load to the source encoding of the required file? — =?ISO-8859-15?Q?Wolfgang_N=E1dasi-Donner?= <ed.odanow@...>

Dear Ruby developers and users!

8 messages 2009/04/17

[#23318] [Feature #1408] 0.1.to_r not equal to (1/10) — Heesob Park <redmine@...>

Feature #1408: 0.1.to_r not equal to (1/10)

19 messages 2009/04/26

[ruby-core:23177] Re: [Bug #1372] Kernel.catch not accepting &block

From: SASADA Koichi <ko1@...>
Date: 2009-04-10 00:17:57 UTC
List: ruby-core #23177
Suraj Kurapati wrote::
> $ cat catch.rb 
> b = lambda { throw :foo }
> catch :foo, &b
...
> catch.rb:2:in `catch': wrong number of arguments (1 for 0) (ArgumentError)
> 	from catch.rb:2:in `<main>'

Proc object generated by lambda method is checked argument number
strictly.  The block which passed to catch method is called with one
argument (tag).  Therefore an error is occuered at Proc#call in your
script (Proc#call is called with one argument, but lambda block can't
accept any argument).

Following script are accepted.

b = lambda {|tag| p tag; throw :foo }
catch :foo, &b # accepted

b = proc {throw :foo }
catch :foo, &b # accepted

-- 
// SASADA Koichi at atdot dot net

In This Thread

Prev Next