Short version: Python and Ruby are usually not run asynchronously. Exceptions and async don't play well together,
On Thu, Apr 4, 2013 at 8:40 PM, Forrest L Norvell <forr...@newrelic.com>wrote: > On Thu, Apr 4, 2013 at 5:39 PM, Nicolas Grilly > <nico...@garden-paris.com>wrote: > >> As of the way exception handling works, V8 is not that different from >> Python and Ruby. In Python and Ruby, you can throw an exception anywhere, >> and catch it somewhere else, without "leaking references" or "creating some >> other sort of undefined brittle state", if your code correctly releases >> allocated ressources using finally statements. What makes JavaScript >> different? >> > > JavaScript itself is no safer or more dangerous than Ruby or Python. > However, putting everything in try/catch/finally clauses is expensive (i.e. > they can't be fully optimized by V8). Also wrapping asynchronous calls in > try/catch is often exactly what you don't want to do, if getting meaningful > error messages is your goal. Domains are intended to be a relatively > inexpensive mechanism to capture information about the cause of a crash > that extends over the length of an asynchronous call chain. They're not a > general-purpose error recovery mechanism. > > Realistically speaking, there's no way to write a general "async finally" > in Node. Side effects are just too pervasive, and while if you're careful > you can ensure that resources are properly cleaned up, it's not a problem > that can be automated. Node 0.8 and 0.10 domains included a > domain.dispose() method that tries to clean up the EventEmitters bound to a > domain, but it's heuristic and will be deprecated in 0.12. > > F > > -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to nodejs+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.