From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,86fd56abf3579c34 X-Google-Attributes: gid103376,public From: Theodore Dennison Subject: Re: Should internet support software be written in Ada? Date: 1995/03/31 Message-ID: <3lhf5e$13c@theopolis.orl.mmc.com>#1/1 X-Deja-AN: 100649470 references: <3kaksj$iur@isnews.calpoly.edu> <3ki9t8$c8l@Starbase.NeoSoft.COM> <3ks2o3$bab@theopolis.orl.mmc.com> <3l6hra$h05@theopolis.orl.mmc.com> <3lbp1k$jij@theopolis.orl.mmc.com> content-type: text/plain; charset=iso-8859-1 organization: IPL InterNetNews site x-url: news:EACHUS.95Mar29173304@spectre.mitre.org mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 1.1b2 (X11; I; SunOS 4.1.3_U1 sun4c) Date: 1995-03-31T00:00:00+00:00 List-Id: eachus@spectre.mitre.org (Robert I. Eachus) wrote: > A simple state machine can be expressed as a case statement in a >loop. A more complex state machine will often have several selection >criteria, or may have states for which the "normal" method of choosing >the next state do not apply. (The canonical example of these is error >recovery.) > > In such a state machine you can keep adding flags and tests to >keep the original structure intact, but a much better approach is to >say goto when you know where to go next. It is much easier to >understand, and, surprise, surprise, it is a lot easier to maintain. > Thank you for your explanation, and your example. In the dispatcher I wrote, I did have a similar problem. I ended up handling it by performing all the error checking BEFORE the dispatching algorithm got called. I also set up all of the dispatching conditions beforehand in boolean expressions (with judicious use of short-circuts and boolean parsing functions). I have to admit that the code for those parts did get kinda ugly. But it made the dispatcher itself relatively simple. It also had the drawback that some parsing might be done more than once. I can see where this would be unacceptable for compiler writers who are worried about benchmark performance. I guess I can see where you guys are comming from now. However, I think your cure may be worse than the disease. T.E.D. p.s. Ignore me, I`m a "structured programming bigot"