[plt-scheme] Borrowing #' aka quote-syntax

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Fri Dec 8 18:03:51 EST 2006

A good old trick is to rebind quote:

Welcome to DrScheme, version 360.2-svn29nov2006.
Language: Pretty Big (includes MrEd and Advanced Student).

 > (let-syntax ([quote
                 (lambda (stx)
                   (display "foo\n")
                   (syntax-case stx ()
                     [(_ datum) #''datum]))])
     (list 'abc '(1 2 3)))
foo
foo
(abc (1 2 3))



Today I wanted to borror #' for my own purpose, so I tried
the same trick:

 > (let-syntax ([quote-syntax
                 (lambda (stx)
                   (display "foo\n")
                   (syntax-case stx ()
                     [(_ datum) #'42]))])
     (list #'abc #'(1 2 3)))
(.#<syntax:22:12> .#<syntax:22:18>)

The first syntax-object contains abc and the other (1 2 3).


Is this intended?

-- 
Jens Axel Søgaard



Posted on the users mailing list.