Syntax-case is required because the macro binds an identifier.  Syntax-rules is not powerful enough to specify that operation.  Define-macro lacks hygiene and should not be considered.<div><br><div class="gmail_quote">On Tue, Sep 28, 2010 at 1:05 PM, R. P. Dillon <span dir="ltr"><<a href="mailto:rpdillon@gmail.com">rpdillon@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">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.<br>

<br>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.<br>

<br>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.<br>

<br>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?<br>

<br>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.<br>

<br>Thanks,<br>Rick<br>
<br>_______________________________________________<br>
Gambit-list mailing list<br>
<a href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a><br>
<a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a><br>
<br></blockquote></div><br></div>