From: Pascal J. Bourguignon on
Tim Bradshaw <tfb(a)cley.com> writes:

> On 2009-11-25 07:42:30 +0000, "Tobias C. Rittweiler"
> <tcr(a)freebits.de.invalid> said:
>
>> Nope, CLHS dictionary entry for IGNORE:
>> The stream variables established by with-open-file,
>> with-open-stream,
>> with-input-from-string, and with-output-to-string, and all iteration
>> variables are, by definition, always ``used''. Using (declare (ignore
>> v)), for such a variable v has unspecified consequences.
>> For understandable reasons, I don't think any implementation
>> actually
>> completely adheres to that.
>
> OK, that's interesting (and answers the question). It's hard to see
> how this would work for an implementation which did rebind each time
> ("It is implementation-dependent whether dolist establishes a new
> binding of var on each iteration or whether it establishes a binding
> for var once at the beginning and then assigns it on any subsequent
> iterations."): such an implementation would have to somehow secretly
> "touch" the binding (or have a secret declaration that the variable
> was actually used, even though it might not be).

Like (declare (ignorable variable)) ?


--
__Pascal Bourguignon__
From: =?iso-8859-1?Q?Bj=F6rn?= Lindberg on
Tim Bradshaw <tfb(a)cley.com> writes:

> On 2009-11-25 07:42:30 +0000, "Tobias C. Rittweiler"
> <tcr(a)freebits.de.invalid> said:
>
>> Nope, CLHS dictionary entry for IGNORE:
>>
>> The stream variables established by with-open-file, with-open-stream,
>> with-input-from-string, and with-output-to-string, and all iteration
>> variables are, by definition, always ``used''. Using (declare (ignore
>> v)), for such a variable v has unspecified consequences.
>>
>> For understandable reasons, I don't think any implementation actually
>> completely adheres to that.
>
> OK, that's interesting (and answers the question). It's hard to see
> how this would work for an implementation which did rebind each time
> ("It is implementation-dependent whether dolist establishes a new
> binding of var on each iteration or whether it establishes a binding
> for var once at the beginning and then assigns it on any subsequent
> iterations."): such an implementation would have to somehow secretly
> "touch" the binding (or have a secret declaration that the variable
> was actually used, even though it might not be).

I don't see why. The text Tobias quotes from the Hyperspec puts a
restriction on the user, but gives full freedom to the
implementation. In the case at hand, an implementation should not warn
for such variables being unused, but doing that for any variable is not
required by the spec either.


Bj�rn Lindberg
From: Tim Bradshaw on
On 2009-11-25 09:33:54 +0000, bjorn(a)runa.se (Bj�rn Lindberg) said:

>
> I don't see why. The text Tobias quotes from the Hyperspec puts a
> restriction on the user, but gives full freedom to the
> implementation. In the case at hand, an implementation should not warn
> for such variables being unused, but doing that for any variable is not
> required by the spec either.

What I'm getting at is that it seems to be hard for an implementation
which rebinds to check for bad user declarations. Implementations do
not have to check of course, but they might want to do so to detect bad
user code.

Such an implementation would have to expand (as Pascal said) to something like

(let ((i ...)) ; or other binding form
(declare (ignorable i)) ; required to stop warnings where variable is unused
... user code ...
)

but ...user code... could start with an IGNORE declaration, so the
implementation would have to check for that (which, OK, it could do).

(And in fact I'm not sure what the effect of an IGNORABLE and IGNORE
declaration for a variable is.)