comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.fi>
Subject: Re: Typing in Ada
Date: Tue, 01 Jun 2004 23:24:08 +0300
Date: 2004-06-01T23:24:08+03:00	[thread overview]
Message-ID: <40BCE5E8.4040305@tidorum.fi> (raw)
In-Reply-To: 9ZRuc.8410$hB2.7017@nwrdny03.gnilink.net

Hyman Rosen wrote:
> Nick Roberts wrote:
>  > That is to say that in most Ada
> 
>> programs it is typical to have constructions such as:
>>    type Apples is range 0..100;
>>    type Oranges is range 0..200;
> 
> 
> Is it really? The very fact that you have named these types as
> you did suggests that the appplicability of ranged types is quite
> limited. In a real program that does something useful, what kinds
> of things do you want to count up to 100 but not to 101? To 200
> but not to 201? Can you give examples from some of your real code

I'm not the original poster, but here are some examples from real code. 
I am implementing the mass memory subsystem for a satellite. The mass 
memory is divided into blocks, pages and octets. There are absolute 
address in the range 0 .. (total number of octets - 1), block numbers in 
the range 0 .. (total number of blocks - 1), page numbers likewise, 
octet offsets within a page, etc, etc. Using strong integer typing I can 
make the compiler check that I don't, by mistake, try to add a page 
number to an octet offset or do other equally senseless things.

To return to Nick Robert's example, the numbers 100 and 200 should 
either come from the requirements specification ("The program shall be 
able to count  up to 100 apples and 200 oranges...") or should appear in 
the software user manual ("The program can count up to 100 apples and 
200 oranges"). So then it is clear that the program satisfies its 
requirements (or it won't compile) and satisfies its user manual, 
whatever range Standard.Integer has on the current platform.

Niklas Holsti




  parent reply	other threads:[~2004-06-01 20:24 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-31 13:32 Typing in Ada Empit
2004-05-31 14:04 ` Poul-Erik Andreasen
2004-05-31 17:01 ` Jeffrey Carter
2004-05-31 20:03   ` Peter C. Chapin
2004-05-31 22:56     ` tmoran
2004-06-01  1:09       ` Peter C. Chapin
2004-06-01  4:40         ` tmoran
2004-06-01 11:26           ` Peter C. Chapin
2004-06-10  3:01             ` Dave Thompson
2004-06-10  3:00         ` Dave Thompson
2004-05-31 23:22     ` Nick Roberts
2004-06-01  1:04       ` Peter C. Chapin
2004-06-01  2:29         ` Nick Roberts
2004-06-02  4:39         ` Robert I. Eachus
2004-06-02 15:17           ` Hyman Rosen
2004-06-01  2:36       ` Hyman Rosen
2004-06-01  4:27         ` Larry Kilgallen
2004-06-01  4:05           ` Hyman Rosen
     [not found]         ` <d4vnb0tepd4togdrvdrbqpok1ne6n9i2vp@4ax.com>
2004-06-01 14:36           ` Wes Groleau
2004-06-01 20:24         ` Niklas Holsti [this message]
2004-06-02  4:43           ` Wes Groleau
2004-06-02  5:28             ` Robert I. Eachus
2004-06-02  8:19               ` tmoran
2004-06-02 14:47               ` Wes Groleau
2004-06-02 11:26             ` Marin David Condic
2004-06-02 14:54               ` gratuitous restrictions (was:Typing in Ada) Wes Groleau
2004-06-02  5:04           ` Typing in Ada Robert I. Eachus
2004-06-01  2:14     ` David C. Hoos
2004-06-02  1:30     ` Jeffrey Carter
2004-06-02 10:53       ` Peter C. Chapin
2004-06-02 11:38         ` Marin David Condic
2004-06-17  2:50           ` Dave Thompson
2004-06-17  4:24             ` James Rogers
2004-06-17 12:28               ` Hyman Rosen
2004-06-17 23:42                 ` James Rogers
2004-06-20 11:27                   ` Nick Roberts
2004-06-20 23:29                     ` new revision ada Brian May
2004-06-21  2:16                       ` tmoran
2004-06-21  2:34                         ` James Rogers
2004-06-22  2:16                           ` Roland Illig
2004-06-22  3:41                             ` James Rogers
2004-06-22  6:53                               ` Martin Krischik
2004-06-21 23:33                         ` Brian May
2004-06-22 20:26                           ` Simon Wright
2004-06-23  0:50                             ` Larry Elmore
2004-06-22 22:06                           ` tmoran
2004-06-21  5:31                       ` Wes Groleau
2004-06-21 12:27                       ` new revision ada (limited with, excpetion handling) Nick Roberts
2004-06-21 13:04                         ` Martin Dowie
2004-06-22 10:38                       ` new revision ada Georg Bauhaus
2004-06-22 12:45                         ` James Rogers
2004-06-22 15:17                           ` Martin Krischik
2004-06-22 16:09                             ` new revision ada (exception handling) Nick Roberts
2004-06-23  7:55                               ` Pascal Obry
2004-06-23  8:40                                 ` Martin Krischik
2004-06-23 19:33                                   ` Randy Brukardt
2004-06-24  6:57                                     ` Martin Krischik
2004-06-24 21:13                                       ` Randy Brukardt
2004-06-25  8:05                                         ` Dmitry A. Kazakov
2004-06-25 17:28                                           ` Randy Brukardt
2004-06-23  4:31                             ` new revision ada Brian May
2004-06-23 19:47                               ` Randy Brukardt
2004-06-22 16:37                           ` Georg Bauhaus
2004-06-26 14:57                           ` Robert I. Eachus
2004-06-01  1:02 ` Typing in Ada Alexander E. Kopilovich
  -- strict thread matches above, loose matches on Subject: below --
2004-06-01  2:11 David C. Hoos, Sr.
2004-06-01  2:13 David C. Hoos, Sr.
replies disabled

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