comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@telepath.com>
Subject: Re: exiting a bloc
Date: Wed, 06 Sep 2000 13:54:27 GMT
Date: 2000-09-06T13:54:27+00:00	[thread overview]
Message-ID: <39B64E94.F081DCAB@telepath.com> (raw)
In-Reply-To: 39B6114B.2929FA58@amsjv.com

Philip Anderson wrote:

> Ted Dennison wrote:
> >
> > arrays (particularly strings) dynamicly on the stack. I think I've also used
> > them in the "accept" alternatives of server tasks or in branches of large
> > command-processing case statements to declare local variables that are
> > unique to that alternative.
>

> anyway - no dynamic arrays, tasks or exceptions.  Branches of case
> statements could arise, but it would seem more readable to call a
> procedure if one is that complicated.

That's quite true for a complicated branch. But I wasn't talking about a
complicated branch. I was talking about a simple branch in a large case statement
(like one I wrote for a embedded device using Alsys's SPARK compiler :-). This
kind of thing happens in command processors a lot. Many of the branches may need
variables that no other branch requires. You could make each small branch a
subprogram. But that would give you tons of little 3-line subprograms, and you
*still* have the huge case statement.

Of course one way to handle this now is to use tagged types and dynamic
dispatching. But if the commands come in from outside the Ada system (as they did
in the system I mentioned above) that won't work. There's no simple way to convert
a command ID into a tagged type's tag.

I'd also dispute the idea that since SPARK disallows a lot of Ada constructs, its
OK to disallow more of them by fiat. To the contrary, I think you *need* all the
language features you can get in SPARK. For instance, pointers are *not*
disallowed in SPARK (at least not by the compiler I used). The allocator "new" was
not available, but that's not the same thing. But I found it invaluable to be able
to use pointers (which I acquired by unchecked_conversion'ing addresses). Many
other developers on the project acted as if pointers were prohibited. So they had
to achieve the same effect using "for use at" overlays, which caused no end of
troubles during integration (in addition to being erronious code when the types
weren't always the same).

--
T.E.D.

Home - mailto:dennison@telepath.com  Work - mailto:dennison@ssd.fsi.com
WWW  - http://www.telepath.com/dennison/Ted/TED.html  ICQ  - 10545591





  reply	other threads:[~2000-09-06 13:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-02 20:10 exiting a bloc Mathias Dolidon
2000-09-02 20:39 ` Mathias Dolidon
2000-09-02 21:01 ` Robert Dewar
2000-09-02 22:34   ` Mathias Dolidon
     [not found]     ` <86snrhkfep.fsf@acm.org>
2000-09-03 15:46       ` Mathias Dolidon
2000-09-05 17:52   ` Richard Riehle
2000-09-06  2:06     ` Ted Dennison
2000-09-06  9:41       ` Philip Anderson
2000-09-06 13:54         ` Ted Dennison [this message]
2000-09-06 21:10           ` Robert Dewar
2000-09-06 23:33             ` Ed Falis
2000-09-07  0:39               ` Robert Dewar
     [not found]               ` <39B72109.89DFAB8C@telepath.com>
2000-09-07 12:34                 ` Ed Falis
2000-09-08 10:33                   ` Ian Caldwell
2000-09-08 13:35                     ` r_c_chapman
2000-09-09  1:52                       ` Robert Dewar
2000-09-12 11:30                       ` Ian Caldwell
2000-09-12 20:13                         ` Robert Dewar
2000-09-09  1:48                     ` Robert Dewar
2000-09-12 11:24                       ` Ian Caldwell
2000-09-12 20:14                         ` Robert Dewar
2000-09-13  8:34                           ` Philip Anderson
2000-09-13 11:02                             ` Peter Amey
2000-09-06  7:00     ` Ray Blaak
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox