Newbie Alert: Discrete Event Simulator

Tres Seaver tseaver at starbase.neosoft.com
Fri Oct 29 14:09:03 EDT 1999


In article <1270961677-6466507 at hypernet.com>,
Gordon McMillan <gmcm at hypernet.com> wrote:
>Bryan Morris wrote:
>
>[big snip]
>> If you're still with me... here's the
>> Problem:
>> The simulation seems to run fine, except after the Scheduler
>> handles a few events I get a Traceback error saying the Scheduler
>> can't find the proper Event_Handler instance.
>> 
>> What I've tried:
>> When I step through the debugger and the Object_Manager stores
>> the name and object instance address (e.g., "Pong instance at
>> AAAA").  The first event to be scheduled for "Pong" tries to get
>> the associated object instance from the Object_Manager but
>> instead it gets back something else (e.g., "Pong instance at
>> BBBB").  Which causes the traceback when I call this instance's
>> Process_Event function.
>> 
>> My questions:
>> a) When I Register an object instance and store it in the
>> dictionary, am I guaranteed that that object instance will not
>> move?  
>
>Yes.
>
>> He says with only a "dangerous" (i.e., little)
>> understanding of what the garbage collection does. As you can
>> imagine, this is kind of critical to my design as it stands. b)
>> If not, any other ideas? c) Have I been vague enough, or do you
>> need more info?
>
>You have been more than sufficiently vague. You are 
>undoubtedly stepping on yourself somehow ;-).

<scratching head> One way to step on yourself is to be overly eager
to resolve issues (think "static typing").  As an experiment, try
having the events store only the _name_ of their handler, and let
the Scheduler do the lookup.

This lets you get clever and switch out the handlers for future events
(not necessarily desirable, but I can think of reasons why I might).

> 
>> I don't really want to send the code for open view until at least
>> I bang my head against the wall a few more times...
>
>We're nice, here. Nobody's rooting for the wall.
>
>at-least-not-publicly-ly y'rs

When-all-you-have-is-a-head-everything-looks-like-a-nail'ly

Tres.
-- 
---------------------------------------------------------------
Tres Seaver           tseaver at palladion.com       713-523-6582
Palladion Software    http://www.palladion.com




More information about the Python-list mailing list