gcl-devel
[Top][All Lists]
Advanced

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

[Gcl-devel] Re: (compile nil #'f)


From: Camm Maguire
Subject: [Gcl-devel] Re: (compile nil #'f)
Date: 31 Mar 2006 10:06:56 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!  Making the head of 'compile look like 

(defun compile (name &optional def &aux tem gaz (*default-pathname-defaults* 
#"."))

  (cond ((not(symbolp name)) (error "Must be a name"))
        ((or (si::interpreted-function-p def) (and (consp def) (eq (car def) 
'lambda)))
         (or name (setf name 'cmp-anon))
         (setf (symbol-function name)
               def)
         (compile name))
        (def (error "def not a lambda expression"))

will work.  This is going into cvs head, or a cleaned up similar.  It
is not required for 2.6.8, right?

Robert Boyer <address@hidden> writes:

> > I suppose it hinges on whether #'f is a lambda expression or a
> > function or something else.
> 
> I'd say that #'f is definitely a function, given this:
> 
>    >(defun f (x) x)
>    FOO
>    >(typep #'f 'function)
>    T
> 
> Based upon what Allegro and ABCL do (along with SBCL and Clisp, as you point
> out), I suspect that GCL really should not cause an error on (compile nil
> #'f), but should somehow extract the LAMBDA and compile it.  Probably very
> easy to do with, given si::interpreted-function-lambda.
> 
> >(si::interpreted-function-lambda (function f))
> 
>   (LAMBDA-BLOCK F (X) X)
> 
> e.g.,
> 
>   (compile nil (cons 'lambda (cddr (si::interpreted-function-lambda (function 
> f)))))
> 
> seems to work ok.  But I have no real understanding of that cddr, of
> si::interpreted-function-lambda, or of LAMBDA-BLOCK.
> 
> Bob
> 
> 
> 
> 
> 
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]