This is the mail archive of the guile@cygnus.com mailing list for the guile project.


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

Re: guile & r5rs


Valentin Kamyshenko <val@kamysh.materials.kiev.ua> writes:

> So, how difficult is it to move all r5rs features to the main
> stream of guile development?

I put a Scheme version of call-with-values in boot-9.scm.  If someone
wants to implement something more efficient, he's welcome to send
patches.

Regarding high-level macros, we plan to support Kent Dybvig's
syntax-case macros directly in the evaluator.  The R5RS macros come as
a subset of the syntax-case macro system, which is as powerful as the
R4RS low-level macros but much cleaner.

Before this happens, you can use Kent Dybvig's implementation which is
is a part of the guile-core distribution.

Example:

1. Put the following lines into foo.scm:
----------------------------------------------------------------------
(define-module (foo)
  :use-syntax (ice-9 syncase))

(define-public x
  (let-syntax ((foo (syntax-rules ()
		      ((_ 1) 2))))
    (foo 1)))
----------------------------------------------------------------------

2. Make sure that the directory where foo.scm exists is on %load-path.

3. Type (use-modules (foo))

x should now be 2

:use-syntax (ice-9 syncase) above causes the entire module to be
passed through Dybvig's transformer.  This is slow.

In most cases it is sufficient to say :use-module (ice-9 syncase), in
which case only contents of syntax-case macro expressions (such as
`define-syntax', `let-syntax' and friends, and the macros they
produce) gets transformed.  This is useful also on a slow computer,
but don't blame Dybvig when you're using syntax-case features outside
of the macro expressions!

NOTE: The :use-syntax thing was broken due to another change until
this very moment, so update your CVS working copy or download
tomorrow's snapshot!

/mdj