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

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Oct 18 11:47:58 EDT 2007

No. See macro-stepper.

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

> On 10/18/07, Matthias Felleisen <matthias at ccs.neu.edu> wrote:
>>
>> 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.
>
> In the case of Noel's code, then:
>
> (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)])))]))
>
> Hygiene would avoid name clashes if all of the properties are
> generated within that macro: think (property x y z) versus (property
> x) (property y) (property z). Otherwise super-secret-field-name would
> get generated 3 times? I think this is the case as I just tried out
> the latter and got name clashes.
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.