"accept"
in the code view (we say ``accepting'')
will behave different, depending on the
last action and the current selection in the list views.
"comment"
in the class menu,
and classes comment is shown in the lower text view
"new class"
or selected "definition"
in the class menu.
"class instvars"
"new method"
in the method menu.
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 accept) 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.
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, and recompile the original methods in the context of the new definition (the same is done when class instance variables are added or removed).
The original class is still physically around, but no longer accessible 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 screennow you add an instance variable
"foo"
to its class descriptionthis 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.
In theory, this is possible (and is actually done by other Smalltalk
systems). The drawback is that the system has to perform a #become:
on all existing instances (and derived instances), which may be very
slow.
ST/X may offer this mechanism in a later release as an option.
Notice:
Occasionally, 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.