[Banshee-List] Hyena.Gui.Theatrics.Stage.ActorStep problem



The Hyena.Gui.Theatrics.Stage.OnActorStep() method returns the result
of the ActorStep handler (if it is not null). There is a potential bug
here if more than one ActorStepHandlers are registered with the Stage:
only the last handler to be registered will effect the outcome of
OnActorStep(). This is unlikely, but possible, and if it were to
happen to some poor dev, I bet they'd have a hell of a time figuring
out what's wrong. Some possible solutions:
* Change the ActorStep event to an ActorStepHandler property. This
will make it perfectly clear that only one handler should be
registered.
* Require the passing of an ActorStepHandler in the Stage constructor.
This has the same effect as the above.
* Add custom add/remove blocks to the ActorStep event. If a handler
has already been registered, throw an exception. Any error-prone code
should encounter this exception as soon as it tries to run.
* Add custom add/remove blocks to the ActorStep event to keep the
registered handlers in a Collection. In OnActorStep, iterate through
the collection and &= the results from each handler. This could also
lead to potentially confusing behavior, but it makes more sense than
the current system.

As I see it, the choice is really over what syntax we prefer. If we
want to go with the event syntax, I think the custom add/remove blocks
and exception is the way to go. The downside is that people don't
expect to get an exception just by registering an event handler. So it
seems to me that a property is the best solution. Other opinions?

-- 
Scott


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]