3 ms·
Raising an exception is a good method. A better method would be a condition system [1], which enables more fine grained handling of such things. throw and catch
by Robin_Message 16y ago
Raising an exception is a good method. A better method would be a condition system [1], which enables more fine grained handling of such things. throw and catch are a kind of bad implementation of this, but there is no reason you couldn't use them, except that very few people do.
In practice, maybe a Ruby linter could/should pick this pattern up and warn about it? It wouldn't be hard to identify functions which return a value based on a block if with no else say.
[1] http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html http://www.gigamonkeys.com/book/beyond-exception-handling-co...