[squeak-dev] Object>>printOn: refined.
marcel.taeumel at hpi.de
Tue Jun 2 12:30:07 UTC 2020
We do this already in Morph >> #printOn:. There, the format is
Am 02.06.2020 14:10:17 schrieb Trygve Reenskaug <trygver at ifi.uio.no>:
I find it frustrating to open 3 inspectors on different objects, all of them titled 'aString' (or whatever),
IMO, it is much better to open them on the 3 objects:  aString,  a String, [4567 a String.
The numbers in square brackets stand for the objects oop, actually its identityHash. They can be a 7-digit numbers; much too long for my short-time memory to hold many of them. I therefore truncate the number to 4 digits, accepting that I may, in rare cases, get 2 objects with the same identifier.
I'm running 'Squeak5.3'.
"Append to the argument, aStream, a sequence of characters that identifies the receiver."
" The previous version identified the class, not the instance "
" This new version identifies the instance with its oop. "
" I arbitrarily truncate the oop to 4 digits to simplify reading. "
| title |
title := self class name.
nextPutAll: '[' , (self asOop printString truncateTo: 4) , ']' ;
nextPutAll: (title first isVowel ifTrue: ['an '] ifFalse: ['a ']);
The essence of object orientation is that objects collaborate to achieve a goal.
Trygve Reenskaug mailto: trygver at ifi.uio.no [mailto:%20trygver at ifi.uio.no]
Morgedalsvn. 5A http://folk.uio.no/trygver/ [http://folk.uio.no/trygver/]
N-0378 Oslo http://fullOO.info [http://fullOO.info]
Norway Tel: (+47) 468 58 625
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev