[plt-scheme] define-for-syntax and R6RS

From: Jos Koot (jos.koot at telefonica.net)
Date: Wed Jun 25 05:37:39 EDT 2008

Thanks for your clear response.
As to the need to use a separate module, you confirmed my surmise.
Jos

----- Original Message ----- 
From: "Sam TH" <samth at ccs.neu.edu>
To: "Jos Koot" <jos.koot at telefonica.net>
Cc: <plt-scheme at list.cs.brown.edu>
Sent: Wednesday, June 25, 2008 4:52 AM
Subject: Re: [plt-scheme] define-for-syntax and R6RS


> Here's an implementation of begin-for-syntax (but it doesn't handle 
> define).
>
> (define-syntax begin-for-syntax
>  (syntax-rules ()
>    [(_ . e) (define-syntax fresh (begin (begin . e) #f))]))
>
> I do not believe there's an R6RS equivalent to define-for-syntax - you
> have to use a separate module.
>
> As for why you need to import begin-for-syntax for run, it's because
> the `begin-for-syntax' macro itself occurs in phase 0.  The
> expressions *inside* the begin-for-syntax are in phase 1.  Similarly,
> in the macro I defined, `define-syntax' appears at phase 0, but
> `syntax-rules' appears at phase 1.
>
> sam th
>
> On Tue, Jun 24, 2008 at 8:44 PM, Jos Koot <jos.koot at telefonica.net> wrote:
>> Because in R6RS I cannot find anything with the same functionality as
>> define-for-syntax or begin-for-syntax, I do the following:
>>
>> #!r6rs
>> (library (mylib)
>>  (export mystuff)
>>  (import
>>   (for (rnrs base (6)) run)
>>   (for (only (scheme base) define-for-syntax) run)
>>   (for (rnrs base (6)) expand))
>>  etc)
>>
>> I am surprised that define-for-syntax must be imported for phase <run> 
>> and
>> does not need an import for phase <expand>. Any light on this would be 
>> very
>> welcome.
>>
>> Is there in R6RS something with the same functionality as 
>> define-for-syntax
>> or begin-for-syntax. I have looked hard around, but did not catch 
>> anything.
>>
>> Greetings,
>> Jos
>>
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
>>
>
>
>
> -- 
> sam th
> samth at ccs.neu.edu 



Posted on the users mailing list.