[plt-scheme] class.ss's init, and non-public fields
From: ian barland (anarchist leader) (ian at cs.rice.edu)
Date: Thu Feb 17 14:40:26 EST 2005 |
|
>>] Only initialization variables declared with init-field can be accessed
>>] from methods; accessing any other initialization variable from a method
>>] is a syntax error.
>>]
>> (1a) Why this restriction?
>
> But `init' arguments act like constructor arguments. You don't
> necessarily want to allocate a slot in each object for each constructor
> argument.
>
"D'oh", of course.
> If the `class' macro could detect which `init' arguments are referenced...
>
I agree that's overkill. As Matthias suggests, I'll just make a
macro named something like "init-private", to complement init and init-field.
I just wanted to make sure I wasn't missing some feature or idiom.
Thanks all,
ian