From: Adam Warner
Subject: Is recursive compilation required by ANSI CL?
Date: 
Message-ID: <pan.2005.04.23.09.35.00.163520@consulting.net.nz>
Hi all,

I'd like to check whether ECL and GCL are non-conforming according to the
ANSI specification in not being able to call COMPILE-FILE recursively.
I suspect recursive compilation could be very difficult to implement when
generating C so even if this is non-conforming it still may not be practical
to fix and rely upon.

ABCL, CLISP, CMUCL and SBCL will happily compile broken.lisp via
(load "precompile.lisp"):

;;---------------
;;precompile.lisp
;;---------------
(eval-when (:compile-toplevel :load-toplevel :execute)
  (compile-file "compile.lisp"))

;;------------
;;compile.lisp
;;------------
(eval-when (:compile-toplevel :load-toplevel :execute)
  (compile-file "broken.lisp"))

;;-----------
;;broken.lisp
;;-----------
(eval-when (:compile-toplevel :load-toplevel :execute)
  (print "***** Bootstrapping *****"))


For example:

* (load "precompile")

; compiling file "/home/adam/t/compile.lisp" (written 23 APR 2005 08:51:03 PM):
; compiling (COMPILE-FILE "broken.lisp")
; compiling file "/home/adam/t/broken.lisp" (written 23 APR 2005 07:47:40 PM):

"***** Bootstrapping *****"

; /home/adam/t/broken.fasl written
; compilation finished in 0:00:00

; /home/adam/t/compile.fasl written
; compilation finished in 0:00:00


This is what happens in ECL:
> (load "precompile")
;;; Loading #P"precompile.lisp"
;;; Loading #P"/usr/local/lib/ecl/cmp.fas"
;;; Loading #P"/usr/local/lib/ecl/sysfun.lsp"
;;; Compiling compile.lisp.
;;; The compiler was called recursively.
Cannot compile broken.lisp.
;;; End of Pass 1.
;;; Note: Emiting FDEFINITION for COMPILE-FILE
;;; Calling the C compiler...
;;; Invoking external command: gcc  -I../include -g -O2 -fPIC -fstrict-aliasing -Dlinux -O "-I/usr/local/lib/ecl//h" -w -c "compile.c" -o "compile.o"
;;; Invoking external command: gcc -o "compile.fas" -L"/usr/local/lib/ecl/" "compile.o"  -Wl,--rpath,/usr/local/lib/ecl/ -shared   -lecl -ldl  -lm
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3
;;; Finished compiling compile.lisp.
#P"precompile.lisp"
>

While the debugger is not entered one can see the messages "The compiler
was called recursively./Cannot compile broken.lisp." plus the
"***** Bootstrapping *****" message is not output at compile time.

Thanks for the analysis!

Regards,
Adam

From: Barry Margolin
Subject: Re: Is recursive compilation required by ANSI CL?
Date: 
Message-ID: <barmar-BE31C4.19495925042005@comcast.dca.giganews.com>
In article <······························@consulting.net.nz>,
 Adam Warner <······@consulting.net.nz> wrote:

> I'd like to check whether ECL and GCL are non-conforming according to the
> ANSI specification in not being able to call COMPILE-FILE recursively.
> I suspect recursive compilation could be very difficult to implement when
> generating C so even if this is non-conforming it still may not be practical
> to fix and rely upon.

There's nothing in the language spec that mentions any restrictions on 
the expressions used within an EVAL-WHEN :COMPILE-TOPLEVEL.  So COMPILE 
and COMPILE-FILE should be usable.

-- 
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
From: Adam Warner
Subject: Re: Is recursive compilation required by ANSI CL?
Date: 
Message-ID: <pan.2005.04.25.23.58.07.871653@consulting.net.nz>
On Mon, 25 Apr 2005 19:49:59 -0400, Barry Margolin wrote:
> In article <······························@consulting.net.nz>,
>  Adam Warner <······@consulting.net.nz> wrote:
> 
>> I'd like to check whether ECL and GCL are non-conforming according to the
>> ANSI specification in not being able to call COMPILE-FILE recursively.
>> I suspect recursive compilation could be very difficult to implement when
>> generating C so even if this is non-conforming it still may not be practical
>> to fix and rely upon.
> 
> There's nothing in the language spec that mentions any restrictions on 
> the expressions used within an EVAL-WHEN :COMPILE-TOPLEVEL.  So COMPILE 
> and COMPILE-FILE should be usable.

Thanks for the confirmation Barry!

Regards,
Adam
From: Hannah Schroeter
Subject: Re: Is recursive compilation required by ANSI CL?
Date: 
Message-ID: <d4lqb0$bi0$1@c3po.use.schlund.de>
Hello!

Adam Warner  <······@consulting.net.nz> wrote:
>Hi all,

>I'd like to check whether ECL and GCL are non-conforming according to the
>ANSI specification in not being able to call COMPILE-FILE recursively.
>I suspect recursive compilation could be very difficult to implement when
>generating C so even if this is non-conforming it still may not be practical
>to fix and rely upon.

Why should this be difficult? Just use different (temporary) file names.

>[...]

Kind regards,

Hannah.
From: Juanjo
Subject: Re: Is recursive compilation required by ANSI CL?
Date: 
Message-ID: <1115057498.967647.210040@z14g2000cwz.googlegroups.com>
The difficulty does not have to do with using C or whatever. It is just
a problem of two old compilers with similar roots, that use a lot of
global variables to keep compiler information and are not reentrant.

Juanjo