[BUG] Browser class-side methods

Brian T Rice water at tunes.org
Sun Sep 8 17:45:53 UTC 2002


I discussed this with Eddie off the list recently, and here's my
perspective:

On Sat, 7 Sep 2002, Eddie Cottongim wrote:

> There are a number of class-side methods in Browser to instantiate a
> browser. Inspecting each of these:
>
> Browser new
> Browser newOnCategory: 'Morphic-Kernel'
> Browser fullOnClass: Morph
> Browser fullOnClass: Morph selector: #delete
> Browser newOnClass: Morph
> Browser newOnClass: Morph label: 'Moo'
> Browser newOnClass: Morph label: #delete
> Browser openBrowser
>
> returns the Browser class for all but the first, which returns a new Browser
> instance. newOnClass: looks like it attempts to return the new Browser
> instance, but does not due to another method returning the class Browser.

Returning the Browser class where you have the opportunity to return a
new, usable result in a place where you would expect one. There has to be
something better than this, although obviously people aren't using these
methods to programmatically work with Browsers (they can't). However, you
were trying to and these methods stood in the way. So it's a good example
of a point where Squeak should grow.

> Shouldn't all of these return either the Browser or SystemWindow instance
> that was created? (I'd prefer the former).

Now here's an interesting point. The Browser instance created doesn't
"own" a SystemWindow, the window merely registers itself as a dependent
along with the relevant submorphs. So the natural thing to do makes
accessing the actual window programmatically easier, but not great.
Whereas if the SystemWindow is returned, simply asking for its model will
give access to the Browser instance.

In any case, I vote for returning the Browser instance. It's a definite
improvement, and is interface-code independent.

> Eddie

If you do modify these methods, I just noticed that Browser's subclasses
all use these methods on the class-side, so the interface benefit carries
across to these extended browser classes.

So put together a change-set and submit it to the harvesters. It has my
vote at least.

My two cents,
~ Brian




More information about the Squeak-dev mailing list