[squeak-dev] [Tools] (Object >> #inspect) now returns the tool instead of the object

David T. Lewis lewis at mail.msen.com
Wed May 20 01:50:04 UTC 2015


On Tue, May 19, 2015 at 11:21:56AM -0500, Chris Muller wrote:
> That logic is sound except from one POV:  which is that #inspect and
> #explore are used as a debugging tools for _users_.  For years, I've
> been able to simply put one word "inspect" in a strategic place in my
> application code to help me debug it.  Now, I'm forced to add
> parentheses, cascades and, in some cases, even temp vars (!!) just to
> avoid getting a SystemWindow tangled up into my domain model.

I think that Marcel's design choice is right, even if it is inconvenient
for the use case that you describe. The reasons are:

1) It is consistent with the way tool building works in general.

2) It provides a useful return value for #inspect. Answering self is
not particularly useful, because I already knew that before I sent #inspect
to it. Answering the tool window is useful in various debugging scenarios,
and it is not otherwise accessible programatically.

> 
> For you as a UI-framework developer, I can understand there might be
> case or two where you would want to debug SystemWindow stuff.  But
> that is the 0.1% usage case.  The 99.9% usage case is Squeak users are
> interacting with their own domain model and they want to use #inspect
> as a debugging tool.

For the use case of embedding #inspect into source code for purposes of
debugging, we could trivially add this to serve the same purpose:

   Object>>inspectYourself
       self inspect

> 
> What do other Smalltalks return from #inspect?  If you want to be
> consistent how about we be consistent with them?

I do not usually find myself arguing in favor of breaking backward compatibility,
but in this case it makes sense and I think it is the right thing to do.

Dave


> 
> On Tue, May 19, 2015 at 3:50 AM, marcel.taeumel <Marcel.Taeumel at hpi.de> wrote:
> > Hi, there! :)
> >
> > I just want to mention and explain, why (Object >> #inspect) now returns the
> > tool window instead of the object as in 4.5.
> >
> > The Tools package adds several convenient methods to the base system:
> >
> > Object >> #explore
> > Object >> #inspect
> > Object >> #browse
> > Behavior >> #browse
> >
> > All but #inspect returned the created tool. So I went for consistency. But
> > in particular, those methods should return the tool because because
> > otherwise the programmer has no simple means to access the created
> > window/tool programmatically. Model and object are, however, always
> > accessible (via #model or just #self).
> >
> > So if you got code like this:
> >
> > self someObjects add: myObject inspect.
> >
> > Please change it to:
> >
> > self someObjects add: myObject inspect; yourself.
> >
> > Or even better to:
> >
> > myObject inspect.
> > self someObjects add: myObject.
> >
> > I think that it is good practice/style to use #yourself if you want to get
> > the receiver back in a chain of calls:
> >
> > self myMorphs add: (MyMorph new color: Color yellow; yourself).
> >
> > Best,
> > Marcel
> >
> >
> >
> > --
> > View this message in context: http://forum.world.st/Tools-Object-inspect-now-returns-the-tool-instead-of-the-object-tp4827263.html
> > Sent from the Squeak - Dev mailing list archive at Nabble.com.
> >


More information about the Squeak-dev mailing list