[Openmcl-devel] Getting inside a compiled-lexical-closure

Sven Van Caekenberghe sven at beta9.be
Wed May 19 02:31:15 PDT 2004


In OpenMCL 0.13.6, I want to see and access some of the variables a 
compiled-lexical-closure is closed over (to get access to the start 
arguments of a process):

In OpenMCL 0.14.1p1 I can do this:

CL-USER> (let ((a-list '(1 2 3))) (defun foobar (x) #'(lambda () 
(append x (list-all-packages) a-list))))
Foobar
CL-USER> (foobar '(100 200))
#<COMPILED-LEXICAL-CLOSURE #x54807A6>
CL-USER> (describe *)
#<COMPILED-LEXICAL-CLOSURE #x53D80D6>
Name: NIL
Arglist (analysis): NIL
Inner lfun: #<Anonymous Function #x53D793E>
Closed over values
X: (100 200)
A-LIST: (1 2 3)
; No value

In OpenMCL 0.13.6 this fails:

Welcome to OpenMCL Version (Beta: Darwin) 0.13.6!
? (let ((a-list '(1 2 3))) (defun foobar (x) #'(lambda () (append x 
(list-all-packages) a-list))))
FOOBAR
? (setf foo (foobar '(100 200))
)
#<COMPILED-LEXICAL-CLOSURE #x52ACCDE>
? (describe foo)
 > Error: Slot INSPECTOR::N-CLOSED is unbound in 
#<INSPECTOR::CLOSURE-INSPECTOR #x52ACECE>
 > While executing: #<CCL::STANDARD-KERNEL-METHOD SLOT-UNBOUND (T T T)>
 > Type :POP to abort.
Type :? for other options.

This is probably an older bug that got fixed.

But anyway I just want the list of closed over values, as a first class 
lisp object...

Is there some way to do this using internal functions ?

Sven




More information about the Openmcl-devel mailing list