prev back next

accepting

Performing "accept" in the code view will behave different, depending on the last action in one of the list views. In general, "accept" always affects the aspect shown in the code view. This means that "accept" will:

The one exception is the full class browser: "accept" may affect all of the above, since it rereads all of the text shown in the codeview (actually a filein).

Unless your changed code has been "accepted", no changes are made to the actual method or class. If you want to change your mind, and go back to the original (actually: the last "accepted") version after editing for a while, simple click on the method (in the methodlist) after a method change or the class (in the classList) after a definition change.

recompilation after a class change

Changing a classes instance- or classInstance variable definition may require a recompile of some or all methods (also often in subclasses). Smalltalk tries to recompile only the minimum set of methods, but still this recompilation may take some time.

Notice, that when you add or remove instance variables to/from a class description and "accept", the system will actually create a new class instead of changing the old one (this is also true for class instance variables).

The original class is still physically around, but no longer accessable by name. It is called an anonymous class and has a category of "obsolete".
The reason for doing this is that existing instances of the class still need their valid class for proper operation (which is the old one, NOT the new one); keep in mind that all specification (i.e. number of instance variables etc.) and protocol (i.e. the list of selectors) are defined in an objects class - therefore, old instances would be in big trouble without a valid class, once they receive a message.

After such a change, the old (anonymous) class is no longer editable by the systemBrowser. The following scenario should give you more insight on this:

consider a view class of yours, of which an instance exists and is visible on the screen

now you add an instance variable "foo" to its class description

this creates a new class (with the original name), and removes the old one from the name tables; the old class is still around but not reachable by the old name. However, if you inspect that class, it will show its old name and a category of "obsolete.

Old instances are therefore no longer affected by any changes in the browser, thus any changes will only make sense for new instances.

Why is this so ?

There are basically 2 other possible solutions to handling this situation:
  1. do not allow a class definition change as long as there are instances
    this would make it impossible, to change things like ScrollBars, TextViews and almost any other class in the system.

  2. convert instances
    this means that existing instances have to either get new fields added (which default value ?) or instance variables removed.

    In theory, this is possible and may be offered in a later release as an option.

Notice:

sometimes, it happens that browsers do not correctly update after such a definition change (i.e. a class definition is changed in one browser, but other browser(s) continue to show the old, obsolete class.
You will notice this when adding new methods, which do not show up in other browsers.
To prevent confusion, it is a good idea to use the "update" menu function of other browsers - or start a new browser if you are in doubt.
This is definitely a bug in ST/X and will be fixed.