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 10:17 PM, Jeff Gonis wrote:
I was playing around with kawa 1.9 as I worked to figure out the
library syntax that arrived with r7rs. I have run into a bit of a
puzzle regarding libraries and built-in functions and I thought I
would contact the list to see if I was misunderstanding the standard,
misunderstanding how kawa interacts with the repl, or just plain
making a mistake.

What you want is reasonable.  However, the REPL (or more generally:
the dynamic top-level environment), as always, causes complications.

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.

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

I get an ExceptionInInitializerError :-(

I will try to figure out what is going on - in both modes.
--
	--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]