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

Misc Queries

    Date: Sat, 23 Nov 85 10:13:25 MST
    From: shebs%utah-orion@utah-cs.arpa (Stanley Shebs)

    While working on PCLS, we've encountered some situations which are probably
    trivial, but which I don't recall having been brought up:

    1) What should (export nil) do?  The CLM says that the first argument
    is either a symbol or list of symbols, but doesn't tell how to handle
    nil.  Personally, I would prefer having nil mean an empty list, but Spice
    code assumes you want to export the symbol nil.

The second sentence of the last paragraph on page 182 is quite explicit.
The Spice implementation is not the definition of the language.

    2) The definition of macroexpand is that it does macroexpand-1 repeatedly,
    while (for instance) PSL macroexpand tries to find all macros in a form
    and expand them.  Is CL macroexpand defined correctly?  

What the book says is "correct" by definition.  Whether it's the best possible
language definition is another matter.

							    If so, is an
    exhaustive macroexpander considered a compiler thing (because of the
    need for special form knowledge)?

Yes.  It's a useful thing to have, but it isn't the same as the macroexpand
function.  It's necessary to have something more general than this to implement
setf correctly, so I expect most implementations have this capability.

    3) What is the general theory of destructive operations during lambda
    list processing (such as by initforms)? For instance, how much structure
    should be shared by an &rest binding and &key bindings?

This would be clearer if you gave an example.  If you're thinking of something
  (defun disgust (&rest r &key (a (setq r nil)) b)
    (list a b))
  (disgust :b 2)
or even worse
  (defun disgust (&rest r &key (a (setf (second r) nil)) b)
    (list a b))
  (disgust :b 2)
I don't think we anticipated that anybody would try this when we were designing
the language.  I'd be happy to say that each of these is an error.

I wasn't able to come up with any problematic examples that didn't involve
modifying the &rest argument.  Did you have others in mind?

    4) What should happen if one does a defun with a documentation string
    included, then later redefines the same function, but without specifying
    a doc string?  Should the old one go away?  Spice Lisp seems to leave
    it alone.

It should go away; think about what happens if you changed the function so that
it no longer conforms to what the old documentation said.
The Spice implementation is not the definition of the language.