[plt-scheme] class.ss: init vs init-field differences?

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sat Apr 7 20:20:07 EDT 2007

An init doesn't allocate any space in the object, so if you have an
object whose initialization arguments are only actually used during
initialization, you can use an init. An init-field, on the other hand,
is both an initialization argument, and a field. So it needs space in
the object (and can be used in a method).

Robby

On 4/7/07, Tato Norren <taton at fastest.cc> wrote:
> Hi. I'm studying the class.ss module to mzscheme. What exactly are the
> differences between init and init-field? They seem to behave identically
> in terms of object creation (with instantiate, etc). The only difference
> I can see is that variables declared with init can't be used in
> procedures (although why the heck would you want to initialize something
> that can never be used??). Can anyone shed some light on the technical
> and practical differences between the two?
> thank you,
> Tato N.
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


Posted on the users mailing list.