I don't understand why the last macro invocation here fails, given
that m4 shows you can store hasheqs and m5 shows you can store
identifiers and m1 shows you can store foos.

#lang racket/base
(require (for-syntax racket/base))
(begin-for-syntax
  (struct foo (x y) #:prefab))

(define-syntax e1 (foo #'e1 2))

(define-syntax (m1 stx)
  (syntax-case stx ()
    [(_ x)
     (quasisyntax (define-syntax x #,(foo #'x 2)))]))

(define-syntax e7 (make-hasheq))

(define-syntax (m4 stx)
  (syntax-case stx ()
    [(_ x)
     (let ([ht (make-hasheq)])
       (quasisyntax (define-syntax x #,ht)))]))
(m4 e8)

(define-syntax (m5 stx)
  (syntax-case stx ()
    [(_ x)
     (quasisyntax (define-syntax x #,(foo #'x #'x)))]))
(m5 e9)

(define-syntax (m6 stx)
  (syntax-case stx ()
    [(_ x)
     (let ([ht (make-hasheq)])
       (hash-set! ht 'y #'x)
       (quasisyntax (define-syntax x #,(foo #'x ht))))]))
(m6 e10)

-- 
-=[     Jay McCarthy               http://jeapostrophe.github.io    ]=-
-=[ Associate Professor        PLT @ CS @ UMass Lowell     ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/CAJYbDa%3D2arSqhvknnG1JGPg7aXDALUQDvUEV%3DJSBTMR6CD8psA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to