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 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to