comp.lang.ada
 help / color / mirror / Atom feed
From: David Kristola <David95037@See-My.Sig>
Subject: Re: Top 10 Language Constructs (Ada)
Date: 2000/07/18
Date: 2000-07-18T00:00:00+00:00	[thread overview]
Message-ID: <01HW.B59982450058903A078EC70C@news.pacbell.net> (raw)
In-Reply-To: 3970F56F.F3A70FAD@icdc.com

On Sat, 15 Jul 2000 16:36:15 -0700, Marc A. Criley wrote
(in message <3970F56F.F3A70FAD@icdc.com>):

> The critical foundation of the Ada programming language is its "type model". 
> (In claiming this I want to credit Doug Bryan for triggering this insight 
> for me at an Ada conference seminar about a dozen years ago.)

I'd like to second David Botton's "Dude!".

Besides being strongly typed, Ada has a very robust type model.  Just
the ability to create subtypes with limited ranges seems to escape many
popular languages.  Add to that the long list of types, and you have a
very powerful means of expressing information.

The other day, i came across a message field in an interface document
that i was coding against.  The field is 16 bits, with the high order
bit being a sign bit, the next highest order bit has the value 2^1,
the third highest bit is 2^0, and so on down to the low order bit,
which is 2^(-13).  The note said that the field is 2's complement.
No problem....

   type Plasma_Volts_Type is delta 0.00012207 range -4.0 .. 3.99987793;
   for Plasma_Volts_Type'Size use 16;

I love fixed point types!  I happen to know that the software on the
other side of that interface is in C.  I wonder how they deal with
that field.

Another important feature of Ada types that people seem to miss:
a type does not have to have a size.  Take boolean for example.  Is
it 8 bits or 1?  That all depends on where you put it.  I could pack
8 boolean flags into a byte, or i could take up that whole byte with
just 1 boolean.  My needs dictate how i use the type.

A word of caution.  Types are the foundation of many programs.
Poorly laid out types can cause all kinds of problems.  I've seen
a case where a bad type choice at a fundamental level caused type
converts to be needed in hundreds of places throughout the code.


-- 
--djk, keeper of arcane lore & trivial fluff
Home: David95036 plus 1 at america on-line
Spam: goto.hades@welovespam.com





  parent reply	other threads:[~2000-07-18  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-14  0:00 Top 10 Language Constructs (Ada) Bruno Gustavs
2000-07-14  0:00 ` Samuel T. Harris
2000-07-15  0:00   ` Simon Wright
2000-07-18  0:00     ` Nick Keighley
2000-07-14  0:00 ` David Kristola
2000-07-14  0:00 ` Andrew Hately
2000-07-15  0:00 ` David Botton
2000-07-15  0:00 ` Marc A. Criley
2000-07-16  0:00   ` David Botton
2000-07-18  0:00   ` David Kristola [this message]
2000-07-18  0:00     ` Stefan Skoglund
2000-07-18  0:00     ` Scott Ingram`
2000-07-18  0:00     ` Bill Brennan
2000-07-18  0:00       ` Dr. Joachim Schr�er
2000-07-19  0:00         ` Bill Brennan
2000-07-18  0:00           ` Scott Ingram`
2000-07-21  0:00         ` Keith Thompson
2000-07-25  0:00           ` Dr. Joachim Schr�er
2000-07-25  0:00             ` Florian Weimer
2000-07-26  0:00             ` David Kristola
2000-07-25  0:00           ` Keith Thompson
2000-07-19  0:00       ` David Kristola
2000-07-24  0:00   ` Richard Riehle
2000-07-26  0:00     ` The Ada type model (was Re: Top 10 Language Constructs (Ada)) Marc A. Criley
replies disabled

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