logoalt Hacker News

bazoom42today at 8:41 AM3 repliesview on HN

So this looks like dynamically scoped callbacks. Instead of passing callbacks along as parameters they are declared as “handlers”, and any function down the call stack can invoke them. Is this a correct understanding?


Replies

AgentMEtoday at 9:28 AM

That's what I was thinking. You could get almost all of this pretty directly in Javascript by putting a callback function in an AsyncLocalStorage instance or, in other languages, in a thread local variable.

_old_dude_today at 10:23 AM

You need more than that for the example with setTimeout(). It requires to be able to freeze the stack and then go back later.

You need stackful coroutine (like goroutine) for that.

show 2 replies
savqtoday at 9:02 AM

Yes. dynamically scoped, and statically typed.

show 1 reply