[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Are nested DEFUN's illegal?



Watch what happens when I type a nested DEFUN form into the CLISP
interpreter (version "1994-10-26 (October 1994)"):

> (defun bar (x)
    (defun foo ()
      (+ x 3)))

*** - THE-ENVIRONMENT is impossible in compiled code

Does this mean that nested DEFUN forms are illegal?  There seems to be no
discussion of this in CLtL2, but on page 92, Steele uses the form above as
an example. 

Note 1:  Perhaps nested DEFUN forms are considered poor style, but is
there a _technical_ reason for disallowing them?  (Naturally, I was able 
to achieve the effect I wanted by creating and passing closures ...)

Note 2:  I believe the 1994-7-4 version of CLISP didn't complain about 
nested DEFUN forms.

Note 3:  The error message refers to 'compiled code'.  What code is that?


Thanks for satisfying my curiosity.


Mark A. Thomas
thommark@access.digex.net