On Apr 15, 5:10 am, Tim Bradshaw <
t...@tfeb.org> wrote:
> I may have missed it, but I am not sure if anyone has really give a concise
> and correct answer to this (there have been concise and wrong ones such as
> the various "define x before you define y which calls x" ones.
I guess that depends on if there exists a concise and correct answer.
"Have you stopped beating your wife yet?"
> Here's a question for implementors: is there any reason why load should not
> add an implicit with-compilation-unit when loading a source file? Would
> that do what I think it should (ie suppress these warnings)? Would it be
> conforming?
As you implied, the compilation of a function when its defining form
is evaluated is optional and incidental. But in the eval-when scheme
of things, there is no :compile-toplevel time - it is all (including
the compilation of each function) part of the :execute time. So no, I
wouldn't suggest the addition of a with-compilation-unit around
something that is not being handled at :compile-toplevel time. Note
that there may be some side-effects of the kind you're looking for,
but those may be incidental and perhaps even accidental, and there
would be no reason to count on them in any implementation or in any
future version of an implementation in which it accidentally works.
On the implementation side, w-c-u leaves a lot of wiggle-room. The
value of the :override argument is unspecified (except that it is
mandated to have the value of nil when it is the one wrapped around a
compile-file). Whether or not cl:compile is enclosed in a w-c-u form
or not, and whether its :override value is nil or not, are
unspecified. On one hand, the name "compilation" in the name implies
anything having to do with compiling, but on the other hand, the name
"unit" implies multiple items acting as one. An incidental
compilation of an evaluated form might or might not be grouped
together into a unit.
Duane