Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's a "shallow binding" implementation of dynamic scope which works fine enough; but if you have coroutines and continuations and such, it might not play along. Whichever thread invokes a continuation will see its own current value of the variable.

Under "deep binding", where we have a dynamic environment stack, we can save that stack as part of the context of the coroutine, continuation or whatever else. It requires only one word: a pointer to the top of the dynamic environment. Whenever we restore that pointer value, we have the original environment.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: