[plt-scheme] A macro for declaring class properties, a question

From: Grant Rettke (grettke at acm.org)
Date: Thu Oct 18 12:23:50 EDT 2007

On 10/18/07, Matthias Felleisen <matthias at ccs.neu.edu> wrote:
> No. See macro-stepper.

I got an error "class*: duplicate declared external field name in:
super-secret-field-name"

when I tried the following:

(module test mzscheme

  (require (lib "class.ss"))

  (provide (all-defined))

  (define-syntax property
    (syntax-rules ()
      [(_ name)
       (begin
         (field (super-secret-field-name null))
         (define/public name
           (case-lambda
             [() super-secret-field-name]
             [(value) (set! super-secret-field-name value)])))]))

  (define service-call%
    (class* object% ()
      (property customer-name)
      (property customer-id)
      (super-new))))


Posted on the users mailing list.