[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: r6rs libraries, round three

From: Julian Graham
Subject: Re: r6rs libraries, round three
Date: Sun, 1 Nov 2009 15:26:49 -0400

Hi all,

Find attached a working prototype of R6RS library support, in the form
of a Guile module called `(r6rs-libraries)'.  The module depends on
the two attached patches, which add, respectively, support for the
`#:version' keyword [1] and support for renaming bindings on export
[2].  It works by transforming the R6RS `library' form into Guile's
native `define-module' form.  Because it's implemented as a macro,
it's only required at expansion time -- the resulting compiled module
has no dependencies on anything besides other Guile modules.

Andreas Rottmann's quasisyntax implementation is included as part of
`(r6rs-libraries)' since it's not yet in master and I was finding it
difficult to model some things without `unsyntax-splicing'.

Also attached are a minimal set of R6RS libraries (as
`r6rs-libs.tar.gz') needed to bootstrap the examples from chapter 7 of
the R6RS spec (attached as `r6rs-examples.tar.gz').  If you place the
r6rs-libraries.scm and the contents of these tarballs somwhere in your
`%load-path', you can run the "balloon party" example as follows:

  scheme@(guile-user)> (use-modules (r6rs-libraries))
  scheme@(guile-user)> (use-modules (main))
  Boom 108
  Boom 24

...and the "let-div" example as follows:

  scheme@(guile-user)> (use-modules (r6rs-libraries))
  scheme@(guile-user)> (use-modules (let-div))
  scheme@(guile-user)> (let-div 5 2 (q r) (display "q: ") (display q)
(display " r: ") (display r) (newline))
  q: 2 r: 1

There are certainly some aspects of this implementation that require
review -- in particular, I've added infrastructure to distinguish
between imports targeted for different "phases" (i.e., `run', `expand'
... (meta n)), but at the moment, all imports are currently included
via #:use-module, which means they're visible at every point from
expansion to runtime.  R6RS seems to explicitly allow this, though,
and, quite frankly, it's much easier to implement.

As I said earlier, I'm happy to provide full documentation for all of
this code if the consensus is that I'm on the right track.


[1] -
[2] -

Attachment: 0001-Complete-support-for-version-information-in-Guile-s.patch
Description: Text Data

Attachment: 0001-Support-for-renaming-bindings-on-module-export.patch
Description: Text Data

Attachment: r6rs-libraries.scm
Description: Text Data

Attachment: r6rs-examples.tar.gz
Description: GNU Zip compressed data

Attachment: r6rs-libs.tar.gz
Description: GNU Zip compressed data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]