Tom Breton <t
...@world.std.com> writes:
> State two: The code is lists, vectors, etc, including comments.
> Stage two: Winnow it.
> State three: The code is lists, vectors, etc, without
> comments. Exactly the same as you get now.
No, not exactly the same as you get now. Right now, *any* object can be
quoted. QUOTE's arguments are an inviolate space that nothing enters.
You seek to change it to say that it's safe for certain operations (the
comment-removing ones) to enter without knowledge of what is safe or
desirable to remove and what is not. This is not what I consider reasonable.
It's like giving the web police to search your web pages and remove anything
that looks like bad words, without regard to the fact that somewhere there
might be a page of the words that are to be removed, or pages of case law
about whether certain words are ok, only to find that the program that
"winnowed" these pages removed the offensive words, in spite of quotation
and/or other specialized context.
It's further complicated by the fact that you can't look for (QUOTE x)
becuase of situations like
(case x ((quote defun) "delay a while") ((+ - *) "more aggressive"))
where (quote defun) is not a quoted form.
And it's further complicated by the fact that even ordinary code might
be "constructed" and not passed through the reader, so all macros everywhere
would have to know whether it was "constructed for printing" (that is,
contains helpful comments that might need removing) or "constructed for
execution" (that is, has comments in awkward places removed and is safe for
execution).
And it's further complicated by the fact that the "macro expansion" phase
is itself opaque to quoting so that
(macrolet ((foo (x) `',x))
(foo (x ;this is a test
y)))
quotes x but you won't know it quotes x until you macroexpand it. But being
a macroexpander, you're suggesting that the comments would be removed before
the macro gets to see the arguments. (The halting problem gets involved here
if you want to solve this by code-analysis before actually running the macro.)
And it's further complicated by the fact that macros can expand into other
calls that might or might not be macros. for example,
(macrolet ((foo (x) (bar x)) (bar (x) `',x))
(foo x))
Here it's clear that (foo x) must not only be entered but able to wholly
complete its action in order to find out whether the item in question
is quoted becuase it's BAR, not FOO, that decides it is quoted.
And it's further complicated by the fact that macros simultaneously think
of some forms as quoted and not by dual use of the self-same datum. Consider
(macrolet ((foo (x) `(if x ',x)))
(foo (car ;this is like first
'(t nil t t))))
where this expands to
(if (car ;this is like first
'(t nil t t))
'(car ;this is like first
'(t nil t t)))
where *if* ";this is like first" is a form, then I want it to be quoted by
the quote, but at the same time, I want it NOT to be a form in the IF.
So there is a problem of overconstrained situation.
In short, EITHER it's the case that macros would have to expect quoted
objects all over the place OR it's the case that you would break quotation
making it impossible for the language to be properly reflective. Right
now, QUOTE is capable of quoting anything that comes out of READ. You
would be punching a big hole in that, and crippling the language's ability
to reason about its own data.