Tag Archive: exception

Apr 22

The Cost of Using Ruby’s Rescue as Logic

Rescue Logic is Expensive

  Code like this: unless nodes.nil? nodes.first else return end Can be written using the seemingly more elegant approach with this ruby trick: node = nodes.first rescue return But then, that got me to thinking… In many languages I have used in the past (e.g., Java and C++), Exception handling is an expensive endeavor. So, …

Continue reading »