From: "Thomas B." Date: 2008-08-29T04:43:45+09:00 Subject: Re: Subtle bug with catch/throw. Am I missing something? Patrick Li wrote: > @enterEvent.listen do > @state = method(:active) > puts "player entered" > throw :exit <-- Throw :exit > end What does this @enterEvent.listen do? If it saves the block passed to it and terminates, and the block gets executed later, when the main control is already out of your idle method, you will get the error. Here's example of an error-producing code to illustrate what I say: class K def listen(&b) @b=b end def idle catch(:a){listen{throw(:a)}} end def call @b.call end end k=K::new k.idle k.call It causes an error even though throw is inside catch, when we look at the code. TPR. -- Posted via http://www.ruby-forum.com/.