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

Optionals



    Date: Mon,  6 Apr 87 16:10:23 EDT
    From: Jonathan A Rees <JAR@ai.ai.mit.edu>

		     ... Please ...
		     explain to me whether or not the following is legal
    Common Lisp and what it returns:

	((lambda (&rest foo &key ((foo foo) 3 foo)) foo)
	    :foo 5 :foo 8 :allow-other-keys nil :allow-other-keys 13)

RPG did not respond to this point in his reply, so I will take
the liberty here:

There are three distinct areas that you are muddling here.  One is the
question of whether Common Lisp specifies the meaning of this
expression precisely and unambiguously.  The second is whether the
facilities of the language can be abused to produce unreadable code.
The third is, if the scond is true, does the language design encourage
such abuse.

The existing Common Lisp specification unfortunately is not entirely
precise unambiguous.  For example, it does not address the question of
whether there may be two parameters of the same name in a single
lambda-list.  (The latest sentiment I have observed is that it should be
an error.)  On the other hand, the first keyword argument FOO will be
bound to 5, not 8; that is specified on page 62.  You have raised an
interesting point concerning :allow-other-keys; the wording of the
second bulleted point on page 63 is unfortunately inconsistent with the
statement on page 62 about taking the leftmost pair.

I think we have already seen in the last week how easy it is to produce
unreadable code, and I will not belabor the point here beyond the simple
assertion that it simply IS NOT A VALID ARGUMENT to assert that a language
is bad because it is possible to write programs that are difficult to
understand.

Now, if you had argued that the design of Common Lisp actively encourages
such abuse, rather than merely permitting it, I would be sympathetic.