From: Yukihiro Matsumoto Date: 2010-03-08T17:12:40+09:00 Subject: [ruby-core:28555] Re: [Bug #2945] Regexp#=== is failed by an exception when the exception is occurred in method_missing Hi, In message "Re: [ruby-core:28554] Re: [Bug #2945] Regexp#=== is failed by an exception when the exception is occurred in method_missing" on Mon, 8 Mar 2010 16:56:14 +0900, Kenta Murata writes: |> |Is this valid behavior? |> |> I think so. What makes you think it's invalid? | |I think the present behavior is unfortunate the following case. |I don't expect raising exception, but printing 2. I have to repeat myself. Why do you expect so? #method_missing raised an exception, no one captured. Why do we expect exceptions to be captured implicitly? | o1 = Object.new | class << o1 | def method_missing(*args) | raise "XXX" | end | end | | case o1 | when /aaa/ | puts 1 | when o | puts 2 | end | #=> `method_missing': XXX (RuntimeError) | |-- |Kenta Murata |OpenPGP FP = FA26 35D7 4F98 3498 0810 E0D5 F213 966F E9EB 0BCC | |E-mail: mrkn@mrkn.jp |twitter: http://twitter.com/mrkn/ |blog: http://d.hatena.ne.jp/mrkn/ | |