[gambit-list] SRFI-41 and syntax-case

R. P. Dillon rpdillon at gmail.com
Tue Sep 28 14:05:25 EDT 2010


I've worked with lisps for a couple of years, but am new to the various
incarnations of macro systems for Scheme (and am by no means proficient with
lisp macros in general).  I'm using the "jump right in" method to learn
more.

I'm interested in bringing more libraries to blackhole-libs, and SRFI-41
(streams) is the first I was interested in working with in my project that
I'm developing in Gambit.  I've extracted the reference implementation from
the SRFI, and have it working (at least in the Gambit interpreter) with just
a couple of modifications.  But a problem has emerged.

SRFI-41 makes use of syntax-rules, which Gambit appears to be OK with.  It
also has one instance of the more-general syntax-case, which appears to be a
problem unless I (load "~~/lib/syntax-case") or use the "-:s" option on the
command line (this is documented in the manual -- thank you!).  If I
distribute the SRFI for use in e.g. blackhole, my understanding is that use
of (load ...) is brittle and is Considered Harmful in modules.

Is there a good approach to addressing this?  Should I attempt to re-write
the syntax-case macro with either syntax-rules (I assume syntax-rules is not
sufficiently powerful enough for this) or with define-macro (macros are
intimidating enough as is; I worry about use of a non-hygienic variety as a
newcomer...)?  Or, is there a way to require the use of the portable
syntax-case implementation when the SRFI-41 module is loaded that doesn't
make use of a brittle mechanism like load?

I didn't want to progress too much farther without verifying this hasn't
already been done or is too difficult a task.  I didn't see it in SLIB or
Blackhole, and I don't think it was in Snow or the Dumping Grounds, but I
might have missed it.  It seems that everything else in blackhole has
avoided the use of syntax-case, but define-macro has been used in at least
one place.

Thanks,
Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20100928/b338bbd9/attachment.htm>


More information about the Gambit-list mailing list