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

Correct me if I'm wrong but can't all of the cases covered by conditions be handled in an OO language by providing an object that one can register conditions with and call signals upon? I'm trying to imagine library support for languages that don't support conditions directly.


You can implement a condition system in any programming language that has dynamically scoped variables. (That was how the original CL condition system was implemented on Lisp that did not have a condition system - only dynamic variables.)

You can implement dynamically scoped variables with a stack of environments, onto which you push entries atop when entering new dynamic scope and from which you pop entries when leaving a dynamic scope. (That is how the original dynamically scoped systems, including Emacs Lisp, were implemented.)

Example: https://github.com/svetlyak40wt/python-cl-conditions




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

Search: