This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: "no declaration seen" warnings on compile but not when running in interpreter
- From: alex mitchell <lexaay at gmail dot com>
- To: Per Bothner <per at bothner dot com>
- Cc: "kawa at sources dot redhat dot com" <kawa at sources dot redhat dot com>
- Date: Wed, 03 Feb 2010 11:23:34 +0800
- Subject: Re: "no declaration seen" warnings on compile but not when running in interpreter
Yes, this seems to be the problem. I was being lazy and letting everything
be implicitly exported, which no longer works. Doing an explicit
module-export for the definitions which should be public fixes it.
thanks,
Alex
On 2/3/10 8:47 AM, "Per Bothner" <per@bothner.com> wrote:
> On 02/01/2010 08:11 PM, alex mitchell wrote:
>> I'm getting a string of "no declaration seen" warnings when compiling my
>> code, warnings which don't appear when I run inside the interpreter. I had
>> the "--warn-undefined-variable" flag set in both compiler and interpreter.
>> If I turn off the warning flag in the compiler, I get "unbound location"
>> errors when I run the resulting classes.
>>
>> Note that the declarations that the compiler complains about are definitely
>> there, and the interpreter is finding them, but the compiler isn't. Is
>> anyone else having any problems like this?
>
> Can the compiler see the declarations at compile-time? I.e. is
> it available using lexical scoping rules? (Or by doing a dynamic
> lookup at compile-time, which rather a hack for getting the builtin
> environment.)
>
> If the variable needs dynamic lookup in the run-time environment.
> the the warning is correct - but it should then fall back to
> dynamic lookup, so it should find the variable at compile-time.
> But it is possible that the declaration isn't "exported".
>
> Note a recent change (from the news.html file):
>
> Top-level bindings in a module compiled with --main are now
> implicitly module-private, unless there is an explicit module-export.
>
> You might want to change your declaration to use define-variable,
> if you want it to be dynamic. If you want it to be lexical, make
> sure it is exported by the defining module, and imported by the
> using module.