[squeak-dev] Object>>printOn: refined.
K K Subbu
kksubbu.ml at gmail.com
Wed Jun 3 15:00:56 UTC 2020
On 03/06/20 5:48 pm, Trygve Reenskaug wrote:
> I clearly need to identify the objects when I see
> them. I understand that other people have other models and need other
> debugging aids. I believe some people don't need my /printOn:/ variant
> because they simplify things by merging the concepts of class and
> instance: "This class sends /open /to that class." It works well as long
> as you can get away with it.
+1. The fun in live programming is all about dealing directly with
instances. Since instances only have numeric oops, I see no harm in
using it as an identity tag.
> The /printOn/:-method does not add to the complexity of the 491 methods
> of class Object; it merely modifies one of them. The method is harmless
> in that it does not influence program execution.
The only tweak I would suggest is to use class name as a prefix in
lowercase to be consistent (e.g. t1, t2 for temps in disassembled code
or references to dropped morphs in workspaces).
nextPut: self class name withFirstCharacterDownshifted;
nextPutAll: self asOop printString truncateTo: 4.
rectangle12 is easier on the eye than " aRectangle". A suffix of
'..' to indicate truncation, perhaps.
Class will have to override this method to print the name instead of
Regards .. Subbu
More information about the Squeak-dev