Boost logo

Boost :

From: Andreas Huber (spam2002_at_[hidden])
Date: 2002-09-11 12:44:31


> Yes, my system is type safe, but I don't define individual types for
> each event, transition, and state. Events are a simple class with a
> string identifier and a property map to contain the parameters. It is
> simple, easy, and doesn't use much memory.

By type-safe I meant compile-time detection of type mismatches. I guess you
can detect type-mismatches only at runtime. Again our fundamental
disagreement...

> BTW, what is gained by typing each event? If your events are generated
> interanally--mine are not--then you can catch, at compile-time, bad
> events. I get messages from the network which are filtered in order to
> determine the kind of event. A simple string identifier seems sufficient
> to me.

Even if you receive events over the network, I believe typing your events
still adds a lot to the safety of your system:
- There's _one_ place that's concerned with detecting bad events, i.e. the
object deserialization mechanism.
- The whole rest of your application works with and benefits from typed
data.

Given that the string identifier of an event is correct then I guess you
only detect in the event-handler that you received an event with some
parameter having the wrong type or missing altogether. Don't you think it's
better to catch such problems at compile-time? How do you handle such a
situation?

Andreas


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk