Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 UW 5/3/83; site uw-june
Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!houxm!hogpc!houti!ariel!vax135!cornell!uw-beaver!uw-june!trow
From: trow@uw-june.UUCP
Newsgroups: net.lang.st80
Subject: Re: Re: instance variable question
Message-ID: <1874@uw-june>
Date: Fri, 19-Oct-84 01:53:24 EDT
Article-I.D.: uw-june.1874
Posted: Fri Oct 19 01:53:24 1984
Date-Received: Tue, 16-Oct-84 06:17:20 EDT
References: <15992@arizona.UUCP> <1838@uw-june> <1302@ritcv.UUCP>
Reply-To: Krasner@Xerox.arpa, Smalltalk80Interest^@Xerox.arpa
Organization: U of Washington Computer Science
Lines: 40


Forwarded from Smalltalk80Interest^@Xerox.arpa

----------------------------------------------------------------

Date: Fri, 12 Oct 84 9:07:37 PDT
From: Krasner.pa
Subject: Re: instance variable question
To: ritcv!jeh@rochester
cc: Smalltalk80Interest^

> BTW, when does the error message get printed, during compilation,
> or execution?

The error message ("foo is undeclared") is written in the system transcript
during (re)compilation.

> but what if you do not recompile?  Is it as if the variable had not been
> deleted, or is recompilation automatic when there is a change to a class's
> variables?

If you do not recompile then your system may blow up.  Example, a class has
instance variables a, b, c, d, and e, and you remove b without recompiling.
The Smalltalk-80 bytecode specification says that instance variable references
are compiled into indexes, and that no bounds checks are performed for instance
variable loads or stores.  New instances will have only four fields, but the
code for accessing c, d, and e would continue to say 3rd, 4th, and 5th field.
The first two will access the wrong field of the object, the last will
access some memory not in this object.

Therefore, recompilation is required when a class's variables change, and is
automatic when that change is invoked in either of the two standard ways in
the system, via a browser or a file-in.  In addition to recompilation, all
existing instances are transformed into new-form instances via "become".

Glenn Krasner
SCL/PARC (krasner.pa@Xerox)

----------------------------------------------------------------