From: daz Date: 2003-10-13T00:02:32+09:00 Subject: Re: set_trace_func/Array#fetch error > > Unfortunately, I guess it doesn't solve the true problem. It's > due to the bug that determining the local jump destination by > ruby_scope. See the thread from [ruby-talk:83729]. > > -- > Nobu Nakada > IMvvHO connecting these two problems would lead to complications. The inject problem is real because it has 'break' in a valid context. The optparse problem has 'return' in a questionable context instead of doing something like: def search ... if ... val = list.fetch(key) {:return_nil} # <--- return nil if val == :return_nil # <--- return val unless block_given? yield(val) end end (I assume here that list might contain keys having OK 'nil' values). Clumsy - but it makes the point that we can code our way out of rare difficulties or refactor them away. The 'unexpected return' error message seems totally sensible for the original optparse code. The error below is, more obviously, also helpful: def roo break end roo #-> C:/TEMP/rb8120.TMP:2:in `roo': unexpected break (LocalJumpError) #-> from C:/TEMP/rb8120.TMP:5 I would fix it by replacing the break. #-> C:/TEMP/rb8120.TMP:2:in `roo': unexpected redo (LocalJumpError) #-> from C:/TEMP/rb8120.TMP:5 Oh dear. It's not my day. Please don't fix this, though. daz (I just saw a reply from Guy to your next message :-)))))