scsh-users
[Top] [All Lists]

Re: run in define-syntax

To: Narang <narang@comcast.net>
Subject: Re: run in define-syntax
From: RT Happe <rthappe@mathematik.uni-freiburg.de>
Date: Sat, 19 Oct 2002 19:07:03 +0200 (CEST)
Cc: <scsh-news@zurich.ai.mit.edu>
On 18 Oct 2002, Narang wrote:

> can someone tell me what's wrong with this

That's a scsh bug.

> > (define-syntax notify
>   (syntax-rules ()

>     ((notify subj obj)
>      (run (mail -s ,subj "narang") (<< ,obj)))))
>
> > > ,expand (notify "test")
>
> Error: unknown i/o redirection
>        (#{Generated << 1311} (#{Generated unquote 1311} ""))

That's the typical symptom of a lax macro transformer that doesn't compare
(the objects representing) identifiers with symbols by the dedicated
comparison function (lambda (form rename COMPARE) ...) but with EQV?
(implicit in CASE conditionals). This hurts as soon as that macro is
called from a syntax-rules macro, since the syntax-rules
transformer renames the symbol << appearing in (the Scheme object
representing the) template into a generated name (a s48 type) such as the
#{Generated << 1311} above.

By the way, the faulty code responsible for your error is, I think,
the function TRANSCRIBE-REDIRECTION in scsh-0.6.2/scsh/syntax-helpers.scm

(A quick & dirty fix would be to extract the symbolic name from the
generated name x by doing `,x.  In this case replace (case (car redir)
                                                  by (case `,(car redir)

But I didn't test that.)

rthappe



<Prev in Thread] Current Thread [Next in Thread>