Created
September 24, 2012 04:42
-
-
Save nyuichi/3774210 to your computer and use it in GitHub Desktop.
deep binding vs shallow binding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; **deep binding** | |
;;; look up | |
(cdr (assq 'the-symbol *the-stack*)) | |
;;; funcall | |
; wind... | |
(loop for arg in args | |
for parm in parms | |
do (push (cons parm arg) *the-stack*)) | |
; call... | |
(eval the-body) | |
; unwind... | |
(loop for parm in parms | |
do (pop *the-stack*)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; **shallow binding** | |
;;; look up | |
(car (symbol-value 'the-symbol)) | |
;;; funcall | |
; wind... | |
(loop for arg in args | |
for parm in parms | |
do (push arg (symbol-value parm)) | |
; call... | |
(eval the-body) | |
; unwind... | |
(loop for parm in parms | |
do (pop (symbol-value parm))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment