[plt-scheme] How to view the results of macro expansion in Dr Scheme?
On 10/18/07, Robby Findler <robby at cs.uchicago.edu> wrote:
> Probably best to supply a (hopefully small) example.
(require (lib "class.ss"))
(define service-call%
(class* object% ()
(property customer-name)
(property customer-id)
(property call-type-code)
(property date-of-call-string)
(super-new)))
(define-syntax property
(lambda (stx)
(define gen-id ; Source: _TSPL3rdEd_ by Kent Dybvig
(lambda (template-id . args)
(datum->syntax-object
template-id
(string->symbol
(apply
string-append
(map
(lambda (x)
(if (string? x) x
(symbol->string (syntax-object->datum x))))
args))))))
(syntax-case stx ()
[(_ name)
(with-syntax
([property-name (gen-id (syntax name) "field-" (syntax name))])
(syntax
(begin
(field (property-name null))
(define/public (name . args)
(if (null? args) property-name
(set! property-name (car args)))))))])))