This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: r7rs libraries question


On 11/09/2014 11:15 PM, Per Bothner wrote:
I tried inlining the define-library into a single file:

(define-library (lib1)
   (import (except (scheme base) square))
   (export square)
   (begin
     (define (square n)
       (* n 2))))

(import (scheme base))
(import (prefix (lib1) lib1-))

(display (square 8)) (newline)
(display (lib1-square 8)) (newline)

When I do the following:
$ kawa -f lib1.scm

I get
16
16
as you describe.

This is because of a feature to support interactive redefinition
of functions: When a function f is redefined, we *reuse* the
old Procedure object.  The problem is that this is happening
to the Procedure object for the builtin square function.
This is a a bug, but I think about how best to fix this.

When I do the following:
$ kawa -f lib1.scm

That should be been (without a -f):

$ kawa lib1.scm

I get an ExceptionInInitializerError :-(

I will try to figure out what is going on - in both modes.

In the case the problem is because the source file lib1.scm
has teh same name as the library lib1.  We generate two classes
with the same name, which confuses things ...

The fix is to rename lib1.scm to something else.

Of course Kawa shouldn't throw an ExceptionInInitializerError -
if we can't implement this case we should at least produce a
compile-time error message.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]