[plt-scheme] How to view the results of macro expansion in Dr Scheme?

From: Robby Findler (robby at cs.uchicago.edu)
Date: Thu Oct 18 09:28:43 EDT 2007

Did you mean for the program below to be in a module? As is, (I think)
you're getting references to undefined identifiers for "property".

With the module wrapper, it appears that the macro stepper's hiding
feature isn't interacting well with macros in the body of a class. But
if you disable it you'll see the expansion of your macros
(eventually).

Robby

On 10/18/07, Grant Rettke <grettke at acm.org> wrote:
> 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)))))))])))
>


Posted on the users mailing list.