[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Binding the same variable twice in a single form
Date: Fri, 13 Apr 90 10:00 EDT
From: Jeffrey Mark Siskind <Qobi@ZERMATT.LCS.MIT.EDU>
...
(defmacro with-my-usefull-environment (&body body)
`(let ((x (foo))
(y (bar))
(z (baz)))
,@body))
...
There are actually TWO different kinds of IGNORE behavior which are
desirable in CommonLisp while there is currently only ONE (official)
mechanism. One desired behavior is to declare that a variable
SHOULD not be used while the other desired behavior is to declare
that a variable MIGHT not be used.
...
I call the second declaration you're looking for IGNORABLE. I personally
wouldn't have minded such a declaration, but I think it ended up taking
a back seat to other issues which were deemed to be more pressing. A key
factor entering into that reasoning is probably that there already a
workaround for its absence that is reasonably portable:
(defmacro with-my-usefull-environment (&body body)
`(let ((x (foo))
(y (bar))
(z (baz)))
x y z ; ignorable
nil ; in case BODY is empty, so Z is not returned
,@body))
Since X, Y, and Z are definitely used (albeit in a trivial way), they
cannot be warned about as unused. In most systems, the accesses are
either totally removed by the compiler or cheap enough that it doesn't
matter much anyway (e.g., the calls to FOO, BAR, and BAZ probably dwarf
their cost).
This perhaps isn't the most graceful solution, but X3J13 does have
charter which outlines its priorities and aesthetics takes predence over
other more practical issues.