[plt-scheme] make-set!-transformer baffling me...

From: Jay Kint (lists at hobbit-hole.org)
Date: Mon Jan 22 23:58:02 EST 2007

I'm playing around with feature expressions (still!), and I feel like
I'm almost there, but I'm running into problem with
make-set!-transformer.

I'm using features at transform time, so I defined my list of features
like this:

  (define-for-syntax features '(plt scheme))

and I'd like to make available the features under the name *features*,
similar to the CL variable name of the same use.  After playing
around, I found make-set!-transformer, which I thought would do
exactly what I want.  I defined this:

  (define-syntax *features*
    (make-set!-transformer
     (lambda (stx)
       (syntax-case stx (set!)
         ((set! *features* expr) (begin (set! features
(syntax-object->datum (syntax expr))) #`'(#, at features)))
         (*features* #`'(#, at features))))))

The variable by itself, *features*, returns (plt scheme), which it
should, but using a (set! *features* '(test plt scheme)) gives me an
error:

reference to undefined identifer: set-quote!

For reference, I found the canonical pwd syntax-id-rules example
translated by one Matthew Flatt:

(define-syntax pwd
     (make-set!-transformer
      (lambda (stx)
        (syntax-case stx (set!)
          [(set! pwd expr) #'(current-directory expr)]
          [(pwd expr ...) #'((current-directory) expr ...)]
          [pwd #'(current-directory)]))))

Running this, I get the error when doing (set! pwd "C:/"):

reference to undefined identifier: set-current-directory!

Any help would be appreciated.  I'm about exhausted.

Jay


Posted on the users mailing list.