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

Issue: LET-TOP-LEVEL (version 1)



re: Problem description:
    The main defining forms in CLtL do not support defining (as opposed to
    creating) closures in lexical environments.
    . . . 
    Rationale:
    Common Lisp tries to support lexical closures but this support is
    really confined to anonymous lambdas within other function
    definitions.  This proposal attempts to move lexical closures closer
    to first-class status in Common Lisp.

I don't believe this problem description.  In particular, previous discussions
on these mailing lists suggested that DEFUN is merely a macro that turns into 
something like:

    (setf (symbol-function 'foo) #'(lambda (x y ...) ...))

so that anything said about "anonymous lambdas" should also be equally
applicable to "defun"'s.


re: Current practice:
    The above example works in both Ibuki Lisp and Lucid, however only
    Ibuki Lisp describes (SYMBOL-FUNCTION 'GET-THING) as a closure.  

In Lucid Common Lisp, *all* functions are "closures".  It doesn't serve
any purpose to distinguish one which has some captured lexical environment
"inside it" from another that doesn't.  [However, I recently adduced reasons
why it would be profitable to distinguish those that are merely "trampolines"
back into the interpreter from the real "compiled functions".]


re: Current practice:
    . . . Both
    Symbolics and TI are reported to leave GET-THING and FREE-THING as
    named-lambdas instead of compiling them.

At least some persons from Symbolics have agreed that this is a flaw in 
the particular compiler's techniques -- not a flaw in language design.


-- JonL --