[comp.lang.smalltalk] Apparent bug, help sought

csrdi@its63b.ed.ac.uk (Janet: rick@uk.ac.ed) (05/15/88)

I'm implementing a simulation system with a graphics interface as part of my
fourth year project. The simulation itself is built on the classes given in
the blue book; I'm basing the interface on the browser code. The system is
being implemented in Macintosh Smalltalk, which is based on a version I image,
so there are a few discrepancies between the system and the book, especially
in the interface code, but none of these are insurmountable.

The structure of the system is this: the interface is a browser
(SimulationBrowser) with three panes: one listing the simulations available,
one listing the objects of the selected simulation, and one showing a graphic
representation of the simulation.

The two listing panes are based on the 'ListView' and 'ListController'
classes, hence there are classes 'SimulationListView',
'SimulationListController', 'SimulationObjectListView' and
'SimulationObjectListController'. At the moment there are only three options
in each of the associated menus; they are 'create', 'remove' and 'rename'.
Selecting any of these causes the appropriate message to be sent to the
controllers' model, which in this case is an instance of SimulationBrowser.

With me so far?

The browser itself accesses the simulations through an instance of
SimulationOrganiser, which keeps track of the existing instances of Simulation
and SimulationObject. The problem is this:

Whenever the browser tries sending a message to its instance of
SimulationOrganiser, it fails with the error:

'UndefinedObject>>doesNotUnderstand:' (whatever the message happened to be).

Okay, so the instance of SimulationOrganiser is an UndefinedObject.

But according to the debugger, it's 'a SimulationOrganiser'. Besides which,
when the SimulationBrowser is created, it sends the message 

SimulationOrganiser new

which doesn't cause an error and does return 'a SimulationOrganiser' in the
appropriate instance variable of SimulationBrowser. Furthermore, if I select
the text of the failing message in the debugger and DoIt, it does work. And
SimulationOrganiser does respond to its own messages. I'm at a loss as to
what is going on. Can any more experienced Smalltalkers offer some advice?
-- 
Janet: rick@uk.ac.ed
BITNET: rick%uk.ac.ed@UKACRL
ARPA: rick@ed.ac.uk
UUCP: rick%uk.ac.ed%ukc@mcvax

"Life would be so much easier if everyone read the manual."

kevin@pdn.UUCP (Kevin Baughman) (05/17/88)

In article <1338@its63b.ed.ac.uk> csrdi@itspna.ed.ac.uk (Rick Innis) writes:
>I'm implementing a simulation system with a graphics interface as part of my
>fourth year project.
>Whenever the browser tries sending a message to its instance of
>SimulationOrganiser, it fails with the error:
>'UndefinedObject>>doesNotUnderstand:' (whatever the message happened to be).
>Okay, so the instance of SimulationOrganiser is an UndefinedObject.
>But according to the debugger, it's 'a SimulationOrganiser'. 

Whenever this has happened to me (in Smalltalk-80), it has always
been caused by a background process not finishing its initialization
before the foreground process gets control.  Then, before entering
the debugger, the backgound process gets its timeslice and changes
the environment.

Seeing how you're doing simulations (which implies to me multiple
concurrent processes) then that might be your problem.

Good luck!

-- 
Kevin Baughman                              Paradyne Corporation
{gatech,codas,ucf-cs}!usfvax2!pdn!kevin     Mail stop LF-207
Phone: (813) 530-8395                       P.O. Box 2826
                                            Largo, FL  34649-2826

csrdi@its63b.ed.ac.uk (Janet: rick@uk.ac.ed) (05/18/88)

Well, it's cleared up - I tried sticking in some code to check the state of
the inst var that was causing the problem, and it went away. So I've just
stuck in a check (isNil) before executing the code. And it seems happy.

Thanks for the reply anyway, Kevin.

	--Rick.
-- 
Janet: rick@uk.ac.ed
BITNET: rick%uk.ac.ed@UKACRL
ARPA: rick@ed.ac.uk
UUCP: rick%uk.ac.ed%ukc@mcvax

"Life would be so much easier if everyone read the manual."