catch
in Ruby is meant to jump out of deeply nested code. In Java e.g. it is possible to achieve the same with Java's try-catch
meant for handling exceptions, it is however considered poor solution and is also very inefficient. In Ruby for handling exceptions we have begin-raise-rescue
and I assume it is also to expensive to use it for other tasks.
Is Ruby's catch-throw
really a more efficient solution then begin-raise-rescue
or are there any other reasons to use it to break nested blocks instead of begin-raise-rescue
?