[plt-scheme] class.ss's init, and non-public fields
At Thu, 17 Feb 2005 10:28:33 -0500, Matthias Felleisen wrote:
> > A different question, also about class.ss. From the docs:
> > ]
> > ] 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?
> > (1b) Is there a workaround better than
> > ...
> > (init size)
> > (define _init init) ; use _init inside my own methods
>
> That makes a field _init. So why noy
>
> (init-field size)
In Ian's example, the field is private; init-field makes them
accessible from the outside.
Robby