[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How's that again?
- To: firstname.lastname@example.org (Bob Hall)
- Subject: Re: How's that again?
- From: smh@Franz.COM (Steve Haflich)
- Date: Tue, 01 Feb 94 09:12:10 -0800
- Cc: email@example.com, e@Flavors.COM, firstname.lastname@example.org
- In-reply-to: Your message of Tue, 01 Feb 94 11:39:09 -0500. <9402011631.AA23671@brazil.cambridge.apple.com>
From: email@example.com (Bob Hall)
On the face of it, a variable is either ignored or not. I see your point,
but I believe the first error message should have said something like
"variable x is written but not read" or the like.
The following removes the error message:
? (defun foo (l)
(dolist (x l)
(declare (ignorable x))
Thanks. Is "IGNORABLE" as portable as "IGNORE"? What about IGNORE-IF-UNUSED?
(see below). My code has to compile in three different common lisps.
(MCL, Franz, Harlequin).
The letter of the law: The dpANS2 is explicit that any iteration
variable binding established by an iteration form is always
automatically considered used, and that an IGNORE declaration on one
is incorrect. However, this was a very late clarification in the
language spec and it will take time for implementations to catch up.
IGNORE and IGNORABLE are standard symbols in the COMMON-LISP package.
IGNORE-IF-UNUSED is not.
The tradiitonal way to achieve the effect of IGNORABLE was to mention
the variable in the body of the form:
(defun foo (l)
(dolist (x l)
You might or might not consider this stylistically ugly, but it's no
more so than lots of other lisp styles, and everyone has seen it lots
of times, so it's unlikely to cause confusion. Most compilers will
not generate any code for such a variable reference, and the code is