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

Re: issue QUOTE-MAY-COPY, version 2

> I'm not real sure if this line of thought is turning out to be
> particularly productive.  To me it seems pretty clear that any copying
> of constants that goes on happens as a result of transforming an
> arbitrary data structure into a program.

Why are the constants transformed at all?  I can see why the
program text (i.e., the list) might be transformed.  The compiler
might compile it, the interpreter might macroexpand it or partially
compile it.  But, unless some writing to a file is involved, why
would any processing be done to the constants?

> In other words, the list
>     (defun foo () '(a b c))
> is just a list.  It doesn't become a program until it is passed to
> EVAL or COMPILE or if it appears in a file being compiled with
> COMPILE-FILE.  The question we are trying to resolve is whether pieces
> of the data structure that represent constant objects must appear
> literally in the resulting program, or whether the transformation may
> construct a equivalent copies instead. 

If that DEFUN appears in a file, it's not a list yet.  READ makes it
a list.  COMPILE-FILE emits something that causes an (A B C) to be
made when the compiled file is loaded.  That list isn't a list until
it's made.  The COMPILE-FILE/LOAD process, like PRINT/READ, returns
an equivalent structure rather than the very same one.  So that's
sort of like copying, but there's always a file operation involved.
Lists don't get copied once they're lists.

Chris's model suggests that the question is whether, for consistency,
some copying must be allowed even when no file operations are involved
(or, rather, after they've all been done).  When we were talking in
terms of what QUOTE did, QUOTE often acted as a bridge for file
compilation semantics to cross over into EVAL and COMPILE.  But maybe
it's possible to think in another way so that notion of consistency
doesn't seem so compelling.

You are now suggesting that we consider the point at which something
becomes a program.  That is more or less equivaplent to pretending
that the expression always comes from a file.  The question is
whether that's the only consistent way to think.

> Perhaps I chose a misleading name for this issue.  I don't think
> anybody is arguing that QUOTE itself must do whatever copying is
> allowed.

There have certainly been messages that suggested that QUOTE might
return a (possibly read-only) copy.  More recently, the idea that
QUOTE might copy once has appeared.  That would correspond to your
idea that EVAL causes a list to become a program.

BTW, it is possible to ensure that only one copy is done?