#|Hello all, I'm looking to define a macro that extends the forms within a racket/class class%. In particular, I would like a form to define a C# like class language form property, that implements the getters and setters for an initialized field automatically.
I'm guessing that someone has written this before however. Can anyone assist with macros that expand into class fields and methods? Ideally, I'd like to move to syntax-parse. |# (define-syntax (define-property syntax) (syntax-parse syntax [((~literal define-property) name:id init-value) #'(define name init-value) (define/public (set-name! init-value) (set! name init-value)) (define/public (get-name) name)])) > define/public: use of a class keyword is not in a class top-level in: (define/public (set-name! init-value) (set! name init-value))
____________________ Racket Users list: http://lists.racket-lang.org/users