Yukihiro Matsumoto wrote:
> (a)
>         File.open('somefile') do |f|
>           begin
> 	    puts f.read
>  	  rescue
>             puts "Can't open"
>           end
>         end
> (b)
>         begin
>           File.open('somefile') do |f|
> 	    puts f.read
>           end
>         rescue
>           puts "Can't open"
>         end
> It's naturally (a) from my point of view, since I know how blocks work
> internally.  But as you did, many might expect (b).  This ambiguity
> may become serious disadvantage.

I expect case a. Sorry I didn't carefully check the code I gave,  "Can't
open " should be " Can't read". That made the ambiguity.

-- 
Posted via http://www.ruby-forum.com/.