prev back next

warning

Especially beginners should not change the definition of any existing class, but stick to their private ones. (even 'gurus' think twice before doing that :-)
The "copy category" function is very helpful when creating experimental versions of new classes - it allows a very quick class duplication.

So, instead of modifying any existing class, it is better to create a new one and copy all methods over from the original one.
Then test & debug the new class until perfect.
When done, you can override the old one with the class "rename" function.

This approach is especially suggested when you modify classes which are used by the system itself, since bugs in those may lead to subtile errors or even crashes.
(just consider modifying ScrollBar to make it err somewhere; since the Debugger uses scrollBars too, it may have problems coming up. As a result, you might be forced to quit smalltalk and restart your session).

problems

Sometimes the browser will show funny source code in the codeview (totally wrong, empty code or off by some characters). This happens, when a sourcefile has been changed or removed from outside the browser (i.e. with FileBrowser or any other editor/program) and the system has not been recompiled or relinked yet (i.e. the compiled class in the executable is not up-to-date).

Since the source information in a method is simply the filename+filePosition, this information is wrong after such a change.

A recompile (using stc) followed by a relink of the smalltalk executable, should give you a version with correct (up-to-date) source information. (however, the free demo version does not include stc - here you have to undo any outside world editing, and only change methods from within the SystemBrowser).