trycatch is nestable as well.
> they can store arbitrary values, timers
Nice. I am currently decoupling trycatch's hooking layer to allow for this arbitrarily[1]. The continuation-local-storage library[2] allows for this functionality as well.
> intercept microtasks
Care to elaborate?
> wrap closures to be associated with the Zone
Yup, similar to domains, though I do wonder when this is necessary? One use case that came up with trycatch was finally support, or the need to exit the current domain/trycatch context.[3]
Lastly, there's one consistent failure I see in all these domain-like, async listener-like, long-stack-trace, event-source modules and that's long-lived resources or how they incorrectly handle EventEmitter handler's context[4], with the core issue being the boundary at which the hook is applied (From Trevor Norris' comment):
After thinking this over, it occurred to me that trycatch is a top down approach. Whereas AsyncListener is bottom up.
Long story short, things like keep-alive sockets will retain a domain/context/zone(?) and their handlers will be called with the incorrect context.Do you fix this in your zone.js implementation?
[1] https://github.com/CrabDude/trycatch/issues/38
[2] https://github.com/othiym23/node-continuation-local-storage