This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: Exception when calling fn. using for-each in Java
- To: Jocelyn Paine <popx at pop3 dot ifs dot org dot uk>
- Subject: Re: Exception when calling fn. using for-each in Java
- From: Per Bothner <per at bothner dot com>
- Date: 20 Dec 2000 08:57:26 -0800
- Cc: kawa at sourceware dot cygnus dot com
- References: <Pine.LNX.4.10.10012201013190.15584-100000@pop3.ifs.org.uk>
Jocelyn Paine <popx@pop3.ifs.org.uk> writes:
> Thanks for the comments about this. As a matter of interest, why
> is it that for-each requires the global environment, but the
> simpiler functions I tested that don't call for-each work without
> registering the environment?
It doesn't appear to be the for-each. Even when I comment out the entire
for-each, the class initializer still needs the environment. This is
because it looks for the binding for <java.util.Vector>. That binding
ends up being "inlined", so the run-time lookup is wasted. So one could
argue that it is a compiler bug that causes the global environment to
be required. Or you could be happy that the compiler is smart enough
to inline the global reference! In any case, if you run Scheme code,
you should expect that the Scheme environment needs to be initialized.
In some cases the compiler may be able to inline things so you don't
need it - but you can't count on that.
It might be better to have the Scheme environment be automatically
loaded, perhaps using a variant of compiler-generated (require ...).
But that has not been implemented.
--
--Per Bothner
per@bothner.com http://www.bothner.com/~per/