I have added it to my image and I find it to be helpful. It gives a nice
indication of object identity, and it does not get in the way of anything that I do. Thanks, Dave On Thu, Jun 04, 2020 at 07:32:52AM +0200, Trygve Reenskaug wrote: > Quite.?? My small /printOn:/ goodie is designed to permeate the whole > image. It will not be part of a release image; people who like it add it > to their image; others don't have to see it. > > On 2020.06.03 21:56, Chris Muller wrote: > >Hi Marcel, > > > >It seems there are a couple??of different dimensions to consider.?? You > >+1'd the idea of sending #asOop from #printOn:.?? I'm definitely a -1 > >on that, because it would force everywhere that doesn't want id to > >override printOn:, and they wouldn't even be able to call "super"!?? > >And even if they DO want id printing, overriding #asOop means they're > >forced to??mix concatenation with streaming, which isn't a good idea.?? > >To stay with streaming, you would at least want a,#printOopOn:, but > >that name is too domain-specific.?? (#asOop is already a common > >selector in persistence frameworks, I think). > > > >A generic, supplementary printing method that works on a Stream avoids > >those issues, and can be either a no-op in Object, OR, > >Object>>#printOn: could check if it #respondsTo: it, allowing the > >supplementary??method to be provided on Object by external frameworks > >without dirtying the Kernel package. > > > >Over the years, I've found having a separate, String-based "id" > >representation (that is not always it's oop / oid), and not any of its > >other attributes of its standard #printString, to be a useful > >extrusion of behavior for disparate domain hierarchies to inherit > >rather than each implement their own. > > > >Best, > >?? Chris > > > > > > > > > >On Wed, Jun 3, 2020 at 3:24 AM Marcel Taeumel <[hidden email] > ><mailto:[hidden email]>> wrote: > > > > Hi Chris. > > > > > Seeing just their identifications removes a level of formality > > that seems to foster a better UI "connection" to the objects. > > > > Domain-specific objects can provide a good-enough identification > > in their #printOn: specialization. Maybe the class name is part of > > it. Maybe not. If you develop a database, for example, you surely > > have another notion of identity. Meaning, other than Object >> > > #identityhash or #oop. That other notion of (compact) identity > > should then be part of an object's print-string that is part of > > the database. > > > > Yet, nothing one can foresee, when thinking about Object >> > > #printOn:. There, you have only the meta-object protocol at hand: > > class name, identity hash, maybe ref counter? :-D Having a new > > subclass of Object, what should that #printOn: look like > > out-of-the-box? The class name is fine. So you can actually see > > that your new class' instances are populating the world. Next step > > should be to implement a custom #printOn: in that new class. > > > > Best, > > Marcel > >> > >> Am 03.06.2020 05:16:31 schrieb Chris Muller <[hidden email] > >> <mailto:[hidden email]>>: > >> > >> Hi Trygve, > >> > >> Of all the attributes that objects print, I find the "type" > >> (class) to be one of the least interesting.?? It's usually already > >> obvious in its contextual usage. Indeed, it is the "identity" > >> that I, too, am??interested in seeing printed.?? My solution since > >> 2006 has been an override of??#printOn: that adds a one-line > >> dispatch to #printIdentificationOn:.?? I then take care in my > >> #printIdentificationOn: implementations to keep the printing as > >> terse as it can be, and sans any line endings,??to serve this > >> seemingly recurring use-case I have of wanting a "short version" > >> of an object's string.?? For example,??when printing the elements > >> of a collection.?? Having entire domain hierarchies exclude the > >> type entirely from their printString's has been a fantastic > >> experience. Seeing just their identifications removes a level of > >> formality that seems to foster a better UI "connection" to the > >> objects. > >> > >> Regards, > >> ?? Chris > >> > >> On Tue, Jun 2, 2020 at 7:10 AM Trygve Reenskaug > >> <[hidden email] <mailto:[hidden email]>> wrote: > >> > >> 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: [1234] > >> aString, [3456] 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'. > >> > >> *Object>>printOn: aStream* > >> ?????????????? "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. > >> ?????????????? aStream > >> ?????????????????????? nextPutAll: '[' , (self asOop > >> printString > >> truncateTo: 4) , ']' ; > >> ?????????????????????? nextPutAll: (title first isVowel > >> ifTrue: ['an > >> '] ifFalse: ['a ']); > >> ?????????????????????? nextPutAll: title > >> > >> Enjoy > >> --Trygve > >> -- > >> > >> /The essence of object orientation is that objects > >> collaborateto achieve a goal. / > >> Trygve Reenskaug mailto: [hidden email] > >> <mailto:%[hidden email]> > >> Morgedalsvn. 5A http://folk.uio.no/trygver/ > >> N-0378 Oslo http://fullOO.info > >> Norway??????????????????????????????????????????Tel: (+47) 468 58 > >> 625 > >> > >> > > > > -- > > /The essence of object orientation is that objects collaborateto achieve > a goal. / > Trygve Reenskaug mailto: [hidden email] <mailto:%[hidden email]> > Morgedalsvn. 5A http://folk.uio.no/trygver/ > N-0378 Oslo http://fullOO.info > Norway??????????????????????????????????????????Tel: (+47) 468 58 625 > > |
> On 04.06.2020, at 16:11, David T. Lewis <[hidden email]> wrote: > > I have added it to my image and I find it to be helpful. It gives a nice > indication of object identity, and it does not get in the way of anything > that I do. I'm all in for having it in the inspector/explorer info, but not the default #printOn: "an Object" dates back to the original st-80, iirc, lets retain it the way it is :) -tobias > > Thanks, > Dave > > On Thu, Jun 04, 2020 at 07:32:52AM +0200, Trygve Reenskaug wrote: >> Quite.?? My small /printOn:/ goodie is designed to permeate the whole >> image. It will not be part of a release image; people who like it add it >> to their image; others don't have to see it. >> >> On 2020.06.03 21:56, Chris Muller wrote: >>> Hi Marcel, >>> >>> It seems there are a couple??of different dimensions to consider.?? You >>> +1'd the idea of sending #asOop from #printOn:.?? I'm definitely a -1 >>> on that, because it would force everywhere that doesn't want id to >>> override printOn:, and they wouldn't even be able to call "super"!?? >>> And even if they DO want id printing, overriding #asOop means they're >>> forced to??mix concatenation with streaming, which isn't a good idea.?? >>> To stay with streaming, you would at least want a,#printOopOn:, but >>> that name is too domain-specific.?? (#asOop is already a common >>> selector in persistence frameworks, I think). >>> >>> A generic, supplementary printing method that works on a Stream avoids >>> those issues, and can be either a no-op in Object, OR, >>> Object>>#printOn: could check if it #respondsTo: it, allowing the >>> supplementary??method to be provided on Object by external frameworks >>> without dirtying the Kernel package. >>> >>> Over the years, I've found having a separate, String-based "id" >>> representation (that is not always it's oop / oid), and not any of its >>> other attributes of its standard #printString, to be a useful >>> extrusion of behavior for disparate domain hierarchies to inherit >>> rather than each implement their own. >>> >>> Best, >>> ?? Chris >>> >>> >>> >>> >>> On Wed, Jun 3, 2020 at 3:24 AM Marcel Taeumel <[hidden email] >>> <mailto:[hidden email]>> wrote: >>> >>> Hi Chris. >>> >>>> Seeing just their identifications removes a level of formality >>> that seems to foster a better UI "connection" to the objects. >>> >>> Domain-specific objects can provide a good-enough identification >>> in their #printOn: specialization. Maybe the class name is part of >>> it. Maybe not. If you develop a database, for example, you surely >>> have another notion of identity. Meaning, other than Object >> >>> #identityhash or #oop. That other notion of (compact) identity >>> should then be part of an object's print-string that is part of >>> the database. >>> >>> Yet, nothing one can foresee, when thinking about Object >> >>> #printOn:. There, you have only the meta-object protocol at hand: >>> class name, identity hash, maybe ref counter? :-D Having a new >>> subclass of Object, what should that #printOn: look like >>> out-of-the-box? The class name is fine. So you can actually see >>> that your new class' instances are populating the world. Next step >>> should be to implement a custom #printOn: in that new class. >>> >>> Best, >>> Marcel >>>> >>>> Am 03.06.2020 05:16:31 schrieb Chris Muller <[hidden email] >>>> <mailto:[hidden email]>>: >>>> >>>> Hi Trygve, >>>> >>>> Of all the attributes that objects print, I find the "type" >>>> (class) to be one of the least interesting.?? It's usually already >>>> obvious in its contextual usage. Indeed, it is the "identity" >>>> that I, too, am??interested in seeing printed.?? My solution since >>>> 2006 has been an override of??#printOn: that adds a one-line >>>> dispatch to #printIdentificationOn:.?? I then take care in my >>>> #printIdentificationOn: implementations to keep the printing as >>>> terse as it can be, and sans any line endings,??to serve this >>>> seemingly recurring use-case I have of wanting a "short version" >>>> of an object's string.?? For example,??when printing the elements >>>> of a collection.?? Having entire domain hierarchies exclude the >>>> type entirely from their printString's has been a fantastic >>>> experience. Seeing just their identifications removes a level of >>>> formality that seems to foster a better UI "connection" to the >>>> objects. >>>> >>>> Regards, >>>> ?? Chris >>>> >>>> On Tue, Jun 2, 2020 at 7:10 AM Trygve Reenskaug >>>> <[hidden email] <mailto:[hidden email]>> wrote: >>>> >>>> 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: [1234] >>>> aString, [3456] 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'. >>>> >>>> *Object>>printOn: aStream* >>>> ?????????????? "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. >>>> ?????????????? aStream >>>> ?????????????????????? nextPutAll: '[' , (self asOop >>>> printString >>>> truncateTo: 4) , ']' ; >>>> ?????????????????????? nextPutAll: (title first isVowel >>>> ifTrue: ['an >>>> '] ifFalse: ['a ']); >>>> ?????????????????????? nextPutAll: title >>>> >>>> Enjoy >>>> --Trygve >>>> -- >>>> >>>> /The essence of object orientation is that objects >>>> collaborateto achieve a goal. / >>>> Trygve Reenskaug mailto: [hidden email] >>>> <mailto:%[hidden email]> >>>> Morgedalsvn. 5A http://folk.uio.no/trygver/ >>>> N-0378 Oslo http://fullOO.info >>>> Norway??????????????????????????????????????????Tel: (+47) 468 58 >>>> 625 >>>> >>>> >>> >> >> -- >> >> /The essence of object orientation is that objects collaborateto achieve >> a goal. / >> Trygve Reenskaug mailto: [hidden email] <mailto:%[hidden email]> >> Morgedalsvn. 5A http://folk.uio.no/trygver/ >> N-0378 Oslo http://fullOO.info >> Norway??????????????????????????????????????????Tel: (+47) 468 58 625 |
On Thu, Jun 04, 2020 at 05:07:25PM +0200, Tobias Pape wrote:
> > > On 04.06.2020, at 16:11, David T. Lewis <[hidden email]> wrote: > > > > I have added it to my image and I find it to be helpful. It gives a nice > > indication of object identity, and it does not get in the way of anything > > that I do. > > > > On Thu, Jun 04, 2020 at 07:32:52AM +0200, Trygve Reenskaug wrote: > >> Quite.?? My small /printOn:/ goodie is designed to permeate the whole > >> image. It will not be part of a release image; people who like it add it > >> to their image; others don't have to see it. > >> > > I'm all in for having it in the inspector/explorer info, but not the default #printOn: > "an Object" dates back to the original st-80, iirc, lets retain it the way it is :) > > -tobias > No argument, I was just saying thank you to Trygve for the goodie that he provided. Dave |
> On 04.06.2020, at 20:14, David T. Lewis <[hidden email]> wrote: > > On Thu, Jun 04, 2020 at 05:07:25PM +0200, Tobias Pape wrote: >> >>> On 04.06.2020, at 16:11, David T. Lewis <[hidden email]> wrote: >>> >>> I have added it to my image and I find it to be helpful. It gives a nice >>> indication of object identity, and it does not get in the way of anything >>> that I do. >>> >>> On Thu, Jun 04, 2020 at 07:32:52AM +0200, Trygve Reenskaug wrote: >>>> Quite.?? My small /printOn:/ goodie is designed to permeate the whole >>>> image. It will not be part of a release image; people who like it add it >>>> to their image; others don't have to see it. >>>> > >> >> I'm all in for having it in the inspector/explorer info, but not the default #printOn: >> "an Object" dates back to the original st-80, iirc, lets retain it the way it is :) >> >> -tobias >> > > No argument, I was just saying thank you to Trygve for the goodie that > he provided. > Sorry for jumping to conclusions :/ -t > |
In reply to this post by marcel.taeumel
Ah, I beg your pardon. My mistake. - Chris |
Hi all,
personally, I am not convinced by displaying the identityHash in each and every inspector window title as shown in Trygve's screenshot. They just make the overall inspector experience a lot more cryptical, compared to a rather small benefit. Also, in my image #asOop returns seven-digit numbers which would cost too much space in the title bars. I think identity comparison is only actually redundant in certain domains or situations, most time you will only open a few inspectors at all.
Isn't there any possibility to show these IDs only on demand? Or can we find a better way to visualize identity than numbers? Maybe a small individual pixel pattern, or shorter IDs that are only unique amongst the class of the inspected object?
Also, please note that having the #reuseWindows preference enabled, this hash is redundant at all because it is not possible to inspect the same object twice.
Best, Christoph Von: Squeak-dev <[hidden email]> im Auftrag von Chris Muller <[hidden email]>
Gesendet: Donnerstag, 4. Juni 2020 21:58:51 An: Taeumel, Marcel Cc: squeak-dev Betreff: Re: [squeak-dev] Object>>printOn: refined.
Ah, I beg your pardon. My mistake.
- Chris
Carpe Squeak!
|
On Fri, 5 Jun 2020 at 1:45 pm, Thiede, Christoph <[hidden email]> wrote:
Make it a preference? It may also be sufficient to show the first N digits of the hash. Could be just one preference: "Number of hash digits shown in inspectors". Fabio
|
Preference would be better than enforcing this change, IMO. > It may also be sufficient to show the first N digits of the hash.
Hm, how "unique" would that be? That could be confusing if you are inspecting two different objects that have similar hashes.
Just another idea (but this one would probably rather belong into a new tool): By sending an universal message such as #flash to an object, all open inspectors/explorers could visually signalize that they
are referring to this particular instance. Maybe this message could be sent also automatically whenever you focus an inspector as well ... Similar to that feature you know from many editors to highlight all occurrences of the selected token, just with windows:
Best,
Christoph
Von: Squeak-dev <[hidden email]> im Auftrag von Fabio Niephaus <[hidden email]>
Gesendet: Freitag, 5. Juni 2020 13:48:18 An: The general-purpose Squeak developers list Betreff: Re: [squeak-dev] Object>>printOn: refined. On Fri, 5 Jun 2020 at 1:45 pm, Thiede, Christoph <[hidden email]> wrote:
Make it a preference? It may also be sufficient to show the first N digits of the hash. Could be just one preference: "Number of hash digits shown in inspectors".
Fabio
pastedImage.png (1K) Download Attachment
Carpe Squeak!
|
Hi, What am I missing here ? All morphs already show their hash. Morph new printString 'a Morph(3577889)' Object new printString 'an Object' Morph>>printOn: aStream | aName | super printOn: aStream. (aName := self knownName) notNil ifTrue: [aStream nextPutAll: '<' , aName , '>']. aStream nextPutAll: '('. aStream print: self identityHash; nextPutAll: ')' On Fri, Jun 5, 2020 at 1:55 PM Thiede, Christoph <[hidden email]> wrote:
|
In reply to this post by Christoph Thiede
Do as I do. Make your own tools. Then you get tools you like, you
know them intimately, and you can change them at whim. It's often
much easier than having a general tool with a billion options.
On 2020.06.05 13:45, Thiede, Christoph
wrote:
--
The essence of object orientation is
that objects collaborate to achieve a
goal. |
> Morph new printString 'a Morph(3577889)' Yes, but an important difference is that this hash is appended to the original representation, not prepended. This is less obtrusive.
> Do as I do. Make your own tools.
True, but it ever hurts me if I write a piece of closed source that is not reusable. And it makes harder synchronizing your image with Trunk/Inbox.
Best,
Christoph
Von: Trygve Reenskaug <[hidden email]>
Gesendet: Freitag, 5. Juni 2020 15:52:22 An: The general-purpose Squeak developers list; Thiede, Christoph; Taeumel, Marcel Betreff: Re: [squeak-dev] Object>>printOn: refined. Do as I do. Make your own tools. Then you get tools you like, you know them intimately, and you can change them at whim. It's often much easier than having a general tool with a billion options.
On 2020.06.05 13:45, Thiede, Christoph wrote:
--
The essence of object orientation is that objects
collaborate to achieve a goal.
Carpe Squeak!
|
Free forum by Nabble | Edit this page |