prototype vs class was Re: Documenting Squeak

Dana Anthony daanth at
Mon Mar 30 21:35:30 UTC 1998

Boris G. Chr. Shingarov wrote:
> Stephen,
> I guess someone already invented this before me but here is
> what I think can be of interest:
> The code & doc browsers -as well as other tools- should be
> tightly integrated.  Imagine e.g. a new user inspecting some
> object with the inspector, and the object has an instance
> variable pointing to an IdentityDictionary.  The user selects
> the IV in the browser and sees 'an IdentityDictionary' in
> the value pane and now he wonders what could this IdDict mean.
> I definitely think there must be a tool integrated into each
> of the other tool, to lead the user to the complete explanation
> of what IdDict is, - by means of just one mouse click.  One
> approach is to use class comments as what such click can link
> to, but I guess a prototype(delegation)-based system gives
> us more field for fantasy, because we can target many of our
> documentation goals by simply defining a mandatory message
> #explain, to return an explanation of what this object is,
> who put it there and for what reason, and how to make profit
> out of it (it obviously can't be elegantly done in a class-
> based system).

I haven't worked extensively with prototype based systems
but I wonder what you mean.  It seems like there is a perfectly
good implementation for this in class based Smalltalk.

simply define 

^self class explainInstance

And in the superclass for classes (Behavior, I think)
define explainInstance to return "instance of", the class comment;
also define Behavior>explain to return "class of", the class comment.

This gives you an acceptable, class comment based system,
which can easily be overriden and extended either at the
class or instance level.  Just define the class method
explainInstance to change instance explanation behavior
that's the same for every instance; define the instance
method explain for instance explanations that vary by
the instance; and override the class method explain to
change the explanation of the class object itself.

> All:  Did anyone see anything similar before?  I'm designing
> a new set of browsers/inspectors/debuggers/workspaces for
> work with Cheese and am looking for fresh ideas (if the tools
> will be nothing more than standard Smalltalk tools then they
> will be not worth implementing - but then Cheese will lack
> any tools and will be usekess and die).

VisualWorks has an explain feature but it does'nt work exactly
this way, I dont' really know how it works, but it might be
> Boris


More information about the Squeak-dev mailing list