Monday, January 9, 2017

defer in Lisp

The Go designers had good reasons to choose 'defer' as the one true mechanism for executing code on scope exit. The usual Lisp strategy of writing custom WITH-macros breaks down as soon as allocation and/or clean up depend on decisions made in the macro body. Implementing a comparable general purpose mechanism in Lisp is trivial, and well worth the effort. The implementation below adds the capability to defer to named scopes.



peace, out