This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: r7rs libraries question
- From: Per Bothner <per at bothner dot com>
- To: Jeff Gonis <jeff dot gonis at gmail dot com>, kawa at sourceware dot org
- Date: Sun, 09 Nov 2014 23:15:33 -0800
- Subject: Re: r7rs libraries question
- Authentication-results: sourceware.org; auth=none
- References: <CAFVyn8TC75s=5EsXZu-fV8kZe_xx_A5xTa0zzu0qi8RNCFAhjw at mail dot gmail dot com>
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/