|
Boost : |
Subject: Re: [boost] Meta State Machine (MSM) review
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2009-12-07 11:05:12
Christophe Henry wrote:
>
> >I wonder if the library can provide a debugging mode that
> >would provide a helpful default implementation
> >of no_transition that could help identify the unknown
> >transition rather than requiring the user to write something?
> >Such a function might access internal details, perhaps only
> >provided in the said debugging mode,
> >that would be clearer about the source state and event for
> >which no transition was provided than would user-level code.
>
> Right now you only get an assert in debug mode. I also wonder if more
> would be possible. About the event, sure, it is already done, about
> the source state, I can't promise anything, but I will have a look at
> it.
> If I understand correctly, you would be satisfied with an assert or
> error message bringing a bit more debug information?
Yes. One person had a question about translating an integer back to user-level information. Another noted the need to write no_transition in order to discover some information about a missing transition rather than getting your assertion. It occurred to me that the library might do better at identifying the needed transition.
I presume doing so would entail storing typeid(T).name() strings mapped against state and event identifiers, if the type information is lost at the point where it is known that a transition is missing. I also presume that whatever you do is likely to be more costly in performance or memory usage, thus my "debugging mode" suggestion.
It boils down to the no_transition handling is likely to be to discover state machine problems in most cases, so the library should be in the best position do that. A more dynamic state machine might need to account for special cases and thus use no_transition as a fallback, so I'm not suggesting removing that facility.
BTW, it would be nice if the library provided a hook for producing the missing transition diagnostic. The library would generate a description and call the hook. The default would write to stderr or assert as now, but the user could override it to write a log file, etc.
_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk