That works ok but if I want to define a class macro like this:

(define-syntax (define/method stx)
  (syntax-parse stx
    [(_ method-list (name arg ...) body)
        #'(begin (define (name arg ...) body)
                 (set! method-list (cons `(name ,name) method-list)))]))

(define-syntax (class stx)
  (syntax-parse stx
    [(_ (init-args ...) body ...)
     #'(lambda (init-args ...)
         (lambda (arg)
           (define method-list '())
           body ...
           (second (assq arg method-list))))]))

and then use it:

(define person-class (class (name age)
                       (define/method method-list (get-name) name)))

racket complains that method-list isn't defined, even though (class ...) 
expands into a function where method-list is defined.

You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to