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

Re: Issue: LET-TOP-LEVEL (version 1)



    Date: Tue, 1 Mar 88 17:06:53 PST
    From: Jon L White <edsel!jonl@labrea.Stanford.EDU>
    To: pierson@mist
    Cc: cl-cleanup@sail.Stanford.EDU
    Subject: Issue: LET-TOP-LEVEL (version 1)
    
As usual, please excuse regrinding.

    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.
    
The relevant sentence is on page 67: "Other implementation-dependent
bookkeeping actions may be taken as well by DEFUN."
    
    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".]
    
I sit corrected, however there appears to be no way in Lucid Common
Lisp to inspect or debug a function which has some captured lexical
environment to see what the captured environment is so I couldn't find
this out.
    
    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.
    
I agree philosophically, but see page 66, second paragraph on
Top-Level Forms.
    
    -- JonL --