4 ms·
The only problem with that is that a termination of your code in between those two points (which could be caused by an exception, a client timeout, etc) leaves
by patio11 17y ago
The only problem with that is that a termination of your code in between those two points (which could be caused by an exception, a client timeout, etc) leaves you right back where we started.
You can use begin/rescue/ensure (Ruby's try/catch/finally) to try to prevent that, but it strikes me as unclean. In addition to having to catch a very wide scope of exceptions, I'm not sure you can actually ensure the ensure block executes. (A trivial example: suppose I call out to library code that I don't understand and, for whatever reason, it calls exit. The ensure block will not execute. Granted, that would take care of my problem because the process was dead, but speaking generally, it is dangerous to assume that ensure actually ensures anything in generic circumstances.)
- stakent 17y agoRight. It seems we are closer to conclusion that side effects are bad. Functional programming on the horizon?