[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Are caguht exceptions global?

Piotr Jastrzabek

7/7/2007 12:20:00 PM

Hi

In rescue clause we can get to thrown object by variable $!
'$' prefix suggests me that this variable is global, but when I'm trying
to access it
beyond rescue block I got Nil class.
I think this is good behavior, but is this means that not all variables
that begins with $
are global?
Or maybe $! is global, but it's being NILed when exiting rescue block
(but why it's global then?)

begin
raise Exception.new("error message")
rescue Exception
puts "Something went wrong ("+$!.inspect+")"
end

puts "Something went wrong ("+$!.inspect+")" # <- NIL Class


Thanks for any answers

--
Piotr Jastrz?bek
2 Answers

ZNUYBV

12/7/2010 11:14:00 PM

0

On Dec 7, 2:52 pm, Phlip <phlip2...@gmail.com> wrote:
> On Dec 7, 1:15 pm, ZNUYBV <tjwilson6...@gmail.com> wrote:
>
> > I never had any sympathy for those who complain about the price of dog
> > and cat food.
>
> Even when the extreme rich whine and moan about it?

Especially when the extreme rich whine and moan about it.

ZNUYBV

12/7/2010 11:18:00 PM

0

On Dec 7, 3:09 pm, "5847 Dead, 990 since 1/20/09" <dead@dead> wrote:
> On Tue, 7 Dec 2010 14:52:58 -0800 (PST), Phlip <phlip2...@gmail.com>
> wrote:
>
> >On Dec 7, 1:15 pm, ZNUYBV <tjwilson6...@gmail.com> wrote:
>
> >> I never had any sympathy for those who complain about the price of dog
> >> and cat food.
>
> >Even when the extreme rich whine and moan about it?
>
> Eventually, nobody except the extreme rich will be able to maintain a
> cat or a dog.  At which point they will whine that they deserve a
> subsidy, because they are being targeted as rich pet owners.

"Anybody who hates children and dogs can't be all bad. "- Not said by
the Great Man but said about him.