17 May 02:04
Re: Matz: can we have rescue/else/ensure available in all blocks?
From: coderrr <coderrr.contact <at> gmail.com>
Subject: Re: Matz: can we have rescue/else/ensure available in all blocks?
Newsgroups: gmane.comp.lang.ruby.general
Date: 2008-05-17 00:04:40 GMT
Subject: Re: Matz: can we have rescue/else/ensure available in all blocks?
Newsgroups: gmane.comp.lang.ruby.general
Date: 2008-05-17 00:04:40 GMT
> I'm certainly not convinced. Maybe you could post a more real world
> example because I'm having a hard time seeing the usefulness in nested
> rescues.
>
>
This has nothing to do with nested rescues. I merely used that in the
example to make it more compelling, although I guess for you it did the
opposite :P
Here's how you can get some real world examples:
cat > findem.rb <<EOF
ARGV.each do |fn|
data = File.read(fn)
ms = data.scan(%r{
do \s* (?:\| [^|]* \|)+ \s*
begin
(?:(?!end).)+?
end \s*
end
}mx)
if ! ms.empty?
puts fn
ms.each{|m| puts m }
end
end
EOF
find /usr/lib/ruby/gems/1.8/gems -name "*.rb" | xargs ruby findem.rb >
the_real_world
for me:
grep \\.rb the_real_world | wc -l
=> 43
- steve
http://coderrr.wordpress.com
RSS Feed