OK, I kind of suspected that was the case (i.e. there was a reason syntax-case was used in the first place). Given that, is there any guidance on how to make a blackhole module dependent on ~~/lib/syntax-case? Is it acceptable to simply use (load "~~/lib/syntax-case")? That's the approach that I'm using now, and I wanted to confirm that it was an acceptable approach.
Thanks, Rick
On Tue, Sep 28, 2010 at 11:17 AM, Phil Bewig pbewig@gmail.com wrote:
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.
On Tue, Sep 28, 2010 at 1:05 PM, R. P. Dillon rpdillon@gmail.com wrote:
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
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list