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

duplicate names in LET*

The rule in Common Lisp should be that you can't have duplicate names in
the same LEXICAL ENVIRONMENT.  This rules out duplicate names in a lambda
list or a LET, and duplicate tags in a tagbody.  But it should not rule
out duplicate names in a LET* because the variables in a LET* are bound in
different lexical environments.  Writing

	(let* ((v1 e1) (v2 e2) (v3 e3))

should be semantically equivalent to

	(let ((v1 e1))
	  (let ((v2 e2))
	    (let ((v3 e3))

It is NOT clear what to do when duplicate names appear in a lambda list or
tagbody; ignoring all but the first occurrence is a quick and dirty fix
that is not justified by the rules of lexical scoping.  But in the LET
expression above it is perfectly clear what should happen when v1, v2, and
v3 are the same symbol.  The equivalent LET* expression therefore has a
well-defined meaning.  Outlawing duplicate names in LET* promotes too
shallow a notion of consistency:  one based on syntax rather than semantics.

-- Dave

PS:  We should also outlaw duplicate names in DO, but not DO*.