[plt-scheme] On hygiene and trust

From: Sam TH (samth at ccs.neu.edu)
Date: Thu Jul 9 15:13:45 EDT 2009

On Thu, Jul 9, 2009 at 3:04 PM, Joe Marshall<jmarshall at alum.mit.edu> wrote:
> On Thu, Jul 9, 2009 at 11:57 AM, Robby
> Findler<robby at eecs.northwestern.edu> wrote:
>>>>> And when I go in the other direction, I have the symbol `foo' and I
>>>>> wish to create some code that uses it, I have to transform it into a
>>>>> syntax object with the appropriate scope.
>>>> (Same as above -- you need to add the extra information.)
>>> But why?  Surely there is a reasonable default.
>> I think that there isn't any reasonable default.
> How about an unreasonable default, then?  Always use the
> scope of the macro and never use the scope of the call-site
> unless explicitly overridden.  Or if that's too cumbersome,
> then the other way.

This is basically what already happens:

(define-syntax (delay* stx)
  (syntax-case stx ()
    [(_ arg)
     #`(lambda (#,'my-sym) arg)]))

(define f
  (let ([my-sym 1]) (delay* my-sym)))

(f #f)

prints 1, since 'my-sym gets the empty syntactic context.

sam th
samth at ccs.neu.edu

Posted on the users mailing list.