From: Andrew Philpot
Subject: compile time and read-time
Date: 
Message-ID: <slrng292fm.5np.philpot@ubirr.isi.edu>
Does compile-file time encompass read-time?

Is something like the following supposed to work?  It's OK in SBCL but
generates a compile-time error in Allegro.  I can make it work with
an EVAL-WHEN, but wondered if such is strictly necessary.

  (in-package :cl-user)

  (defconstant +rtc1-a+ 1)

  (defconstant +rtc1-b+ (+ 2 #.+rtc1-a+))

-- 
Andrew Philpot
USC Information Sciences Institute
·······@isi.edu

From: Thomas A. Russ
Subject: Re: compile time and read-time
Date: 
Message-ID: <ymihcd79sid.fsf@blackcat.isi.edu>
Andrew Philpot <·······@isi.edu> writes:

> Does compile-file time encompass read-time?
> 
> Is something like the following supposed to work?  It's OK in SBCL but
> generates a compile-time error in Allegro.  I can make it work with
> an EVAL-WHEN, but wondered if such is strictly necessary.
> 
>   (in-package :cl-user)
> 
>   (defconstant +rtc1-a+ 1)
> 
>   (defconstant +rtc1-b+ (+ 2 #.+rtc1-a+))

I would think you might need to do that, since a multi-pass file
compiler might try to read all of the forms before establishing the
constant binding.



-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: Duane Rettig
Subject: Re: compile time and read-time
Date: 
Message-ID: <o0fxsr119l.fsf@gemini.franz.com>
Andrew Philpot <·······@isi.edu> writes:

> Does compile-file time encompass read-time?

Sort of.  The time is encompassed, but not necessarily the place.

> Is something like the following supposed to work?  It's OK in SBCL but
> generates a compile-time error in Allegro.  I can make it work with
> an EVAL-WHEN, but wondered if such is strictly necessary.
>
>   (in-package :cl-user)
>
>   (defconstant +rtc1-a+ 1)
>
>   (defconstant +rtc1-b+ (+ 2 #.+rtc1-a+))

That's because the defconstant is defining the name into the
compilation environment, but the reader is getting definitions from
the run-time environment.  If the compilation environment is separate
from the run-time environment (as it often is), then it has the useful
feature of not accidentally executing at compile-time a definition
that was meant to be executd when the compiled file is loaded in.

We've already had a few discussions in this ng on this subject,
including this thread:

http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/170d01370010f113/8eb1ab2ca298656d?lnk=st&q=Compilation+environment#8eb1ab2ca298656d

and this one:

http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/d770c3a176511665/18c8733e8947fd86?lnk=st&q=Compilation+environment#18c8733e8947fd86



-- 
Duane Rettig    ·····@franz.com    Franz Inc.  http://www.franz.com/
555 12th St., Suite 1450               http://www.555citycenter.com/
Oakland, Ca. 94607        Phone: (510) 452-2000; Fax: (510) 452-0182