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

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Oct 18 09:53:35 EDT 2007

Hygiene means create names to avoid binding conflicts. So in this case,
imagine that each use of (property name) would actually introduce
super-secret-name1, super-secret-name2, etc. See macro stepper.

-- Matthias



On Oct 18, 2007, at 9:43 AM, Grant Rettke wrote:

> On 10/18/07, Noel Welsh <noelwelsh at gmail.com> wrote:
>> Something like this would do:
>>
>> (define-syntax property
>>   (syntax-rules ()
>>     [(_ name)
>>      (begin (field super-secret-field-name)
>>             (define/public name
>>               (case-lambda
>>                 [() super-secret-field-name]
>>                 [(value) (set! super-secret-field-name value)])))]))
>
> I'm confused about the hygiene here. Wouldn't the class end up having
> duplicate field names 'super-secret-field-name', or are those made
> clean when referenced by the class?
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.