This means, that to rename a method, you'd have to select it,
edit the code, accept the new definition, reselect the old one,
verify that the old method is no longer called or change the callers as
required and finally remove it (via the menu).
Or you can use the method list's "Rename" menu function, which does all of
the above for you, including the rewrite of any caller.
The system's settings dialog also allows for "Completion as you type" to be enabled. Then, a little floating menu showing possible completions will appear automatically, as you type. If any of the suggested completions makes sense, you should either click on the entry in the list, or select it by navigating with CTRL-Cursor keys and pressing return on the selection. We choose to use CTRL- as a modifier, as it turned out to be a bit confusing if the normal cursor keys lead to completions.
Also many rewrite and refactoring functions are found on the codeview popup menu (especially: the code menu, which is reached quickly by pressing the "Shift" key while clicking).
If enabled in the settings, a background code checker (called "SmallLint" will constantly look over your shoulder and give little warning notifiers in the left line number area. Move the mouse over the icon to see a short summary of what it thinks, or click on the warning icon to see more detail. Some of those may even include an offer to rewrite the code for you.
The new code editor is still considered somewhat experimental; and can be disabled via the launcher's "Tools"-"Code Editor 2" settings menu.
"accept"
in the code view (we say ``accepting'')
will behave different, depending on the last action in one of the list views.
In general, accepting always affects the aspect shown in the code view.
"comment"
in the class menu
"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.
In addition, the new browser keeps a history of the last few changes made, and allows undo via the operations menu.
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 on the class side, if 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 object's 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.
This is possible, and is actually done by many 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.
Copyright © 2000 eXept Software AG, all rights reserved
<info@exept.de>