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

Memorial Day Ballot comments



    Date: Mon, 30 May 1983  15:28 EDT
    From: Skef Wholey <Wholey@CMU-CS-C>

    8. Why must destructing live in lambda lists?  I think a destructing form would
    be much more useful (if you can do destructuring in defmacro's, why not other
    places like compiler transforms?).  How about a macro DESTRUCTURE...

It's important for documentation reasons that the destructuring in a DEFMACRO
be up at the top, not buried inside the body somewhere.  To give a simple
example, we have an editor command that prints the argument list of the form
that that the cursor is in.  For a macro with complex syntax, you certainly
want this command to tell you about the syntax.

However, you are quite right that the destructuring operation is useful
by itself.  We call it DESTRUCTURING-BIND, a rather terrible name.
DEFMACRO is nothing but a convenient packaged combination of MACRO
and DESTRUCTURING-BIND.  I haven't proposed DESTRUCTURING-BIND for
Common Lisp recently, because of the name (although it is analogous
to MULTIPLE-VALUE-BIND I guess) and because it might seem too complicated.

    12. Where would the name be stored?  Our DEFSTRUCT uses a special subtype code
    to say that the thing's a named structure, and stashes the name in slot 0 of
    the vector.  So the slots are all "moved up one" into the vector.  It seems
    that the manual would have to specify something about the implementation, i.e.
    where the name is stored.

Indeed for DEFSTRUCT to be a portable program it has to know whether the
name of a named-vector takes up space in the vector.  If the only named
type in the common language is simple (general) vector, then I see no
problems with legislating that the name goes in slot 0.  And surely most
implementations would rather do it that way, rather than having named
vectors take on a different storage representation than ordinary vectors.
Of course if you wanted named bit-vectors this wouldn't work, but I see no
need for that by DEFSTRUCT.

Scott, shall we have an auxiliary mini-ballot on these two things?