The two characterizations I gave are different. I'm not sure which
one, if any, you are endorsing.
Do you want "unused import" to mean:
1. "import for which you cannot tell from the behavior of the script
whether it is present or absent", OR
2. "import none of whose exports are referenced anywhere in the script
(or library body) at any time"
I think they are different, so you would have to pick one (or neither).
This definition of "unused" is for what you would want out of Ikarus
when you give the --warnings flag.

On Tue, May 5, 2009 at 9:39 PM, Michele Simionato
<[email protected]> wrote:
> On Tue, May 5, 2009 at 12:47 PM, Ramana Kumar <[email protected]> wrote:
>> One straightforward interpretation of "import forms which are ignored
>> by the compiler" could be "import specs for which you cannot tell
>> whether they are present or absent from the behavior of the script."
>> But then you can't define "unused libraries" that are imported into
>> libraries: I think whether or not they are "unused" will depend on the
>> top-level script.
>
> Yes.
>
>> However I think Michele also wanted to include cases where you can
>> tell by observing, say, the printed output coming from an expression
>> in a library body. So an alternative interpretation could be "import
>> specs none of whose exports are referenced anywhere in the
>> script/library body (at any time)". (In this case, (only (foo)) would
>> always count as "unused" since it provides no opportunities for
>> referencing an export.)
>
> In Ikarus (only (foo)) counts as "unused", in all other implementations
> counts as "used" instead, since I could tell the difference via
> side effects:
>
> (library (foo)
> (export)
> (import (rnrs))
> (display "foo instantiated\n"))
>
> $ cat x.ss
> (import (only (foo)));; the message is printed in all implementations
> except ikarus
>
> I would like Ikarus to give a warning in this case, at least when
> the switch --warnings is enabled; I would like more, but I realize that
> I have no hope to convince Aziz to make Ikarus dumber.
>

Reply via email to