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

A Hole in Common Lisp



    Date: Sat, 6 Jun 1987  21:01 EDT
    From: "Scott E. Fahlman" <Fahlman@C.CS.CMU.EDU>

    Even if I wanted to mix positional and named args in a single function,
    I don't like your way of doing it -- it seems treacherous to me.  If the
    value of certain arguments to a function happen to match the named
    arguments, things get interpreted in an unintended and very mysterious
    way.

Exactly.  If an argument can sometimes be a value for a parameter, and
other times be the name of a parameter, it can be very confusing.
Haven't we seen this same suggestion before and rejected it for that
reason?  I can't remember whether "we" was the Common Lisp committee a
few years ago or a bunch of hackers sitting around at MIT a few years
before that.  Anyway, my preference is to tread very cautiously on this.

    I have sometimes thought that if I were designing a lisp-like language
    from scratch, I would leave the question of by-postion or by-name
    arguments to the caller of a function....
    There [would be] two forms of function calling, positional and by-arg-name
    either of which can be used on any function.  They need to be
    syntactically distinguished somehow.  I'll use square brackets to group
    the name/argument pairs in the latter -- this might be a read macro that
    turns into some three-element list with a reserved token in the car.

    (function-name pos-arg-1 pos-arg-2 pos-arg-3 ...)

    (function-name [nameX argX] [nameY argY] ...)

This is very like the way Ada does it.  If we were redesigning Lisp, my
preference would be to do it this way too.  However, I'm sure we'd have
people screaming that we were destroying Lisp by introducing new syntax
and by eliminating the ability to understand keyword arguments in terms
of getf and &rest.  Maybe instead of fixing Lisp to be more like Ada, I
ought to be thinking of fixing Ada to be more like Lisp.