From: Vladimir Sizikov Date: 2008-07-06T22:07:58+09:00 Subject: [ruby-core:17629] Proper exception out of throw? Hi, (I'm reviewing some of the RubySpec tests and I"d like to get ruby-core opinion on some Ruby behavior). According to ruby-doc: Kernel.throw: Raises NameError if there is no catch block for the symbol. Also, the "Ruby Programming Language" book, the latest edition, also says that NameError is raised. But it seems that MRI 1.9 raises ArgumentError. ruby -ve "throw :blah" ruby 1.8.7 (2008-07-05 revision 0) [i686-linux] -e:1:in `throw': uncaught throw `blah' (NameError) from -e:1 ruby -ve "throw :blah" ruby 1.9.0 (2008-07-04 revision 0) [i686-linux] -e:1:in `throw': uncaught throw :blah (ArgumentError) So, the first question is: what is the correct behavior? At any rate, it seems that either docs for 1.9 should be corrected, or the behavior of MRI 1.9 should be reverted to specified behavior. The second question is less important: According to ruby-doc for NameError: name_error.name => string or nil but in our case the #name method is actually returning a symbol, not a string. Should the doc be corrected somehow or the behavior corrected (less desirable, since this will break the compatibility with all existing code that expects symbols, if there is such code). Thanks, --Vladimir