Proposal: #symbol printing
Stefan Matthias Aust
sma at 3plus4.de
Mon Apr 24 22:26:06 UTC 2000
There was some discussion about the "#" issue recently so let's
PROPOSAL
Change Symbol printString to emit
#xxx
if xxx is a valid smalltalk identifier and
#'xxx'
otherwise. There should be already a method to determine whether a symbol
is a valid identifer but I don't know its name at the moment.
PROBLEMS
A lot of stuff will break (especially in the Browser and other tools),
mainly because
aStream print: aSymbol
is (mis)used instead of
aStream nextPutAll: aSymbol
This needs to be fixed. As 2.8 shouldn't be affected by this change, I'd
recommend to apply this change to 2.9a once its started.
WORKAROUND
Provide the old implementation in a method called #displayString. Also
provide a #display: method for Streams. Then introduce the change and fix
the problems that will occur by replacing #printString or #print: with the
according display methods.
Object>>displayString
^ self printString
Stream>>display: anObject
self nextPutAll: anObject displayString
REASONING
The refactoring goal is to eventually replace all textual display methods
with special display methods and keep the print methods to the debugger and
inspector. The rule is: printString is for the programmer to debug,
displayString for the program to view. The same framework is used in
VisualWorks and Dolphin Smalltalk.
bye
--
Stefan Matthias Aust // Bevor wir fallen, fallen wir lieber auf
More information about the Squeak-dev
mailing list
|