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,5f764f1f7822ab9c X-Google-Attributes: gid103376,public From: David Kristola Subject: Re: Top 10 Language Constructs (Ada) Date: 2000/07/18 Message-ID: <01HW.B59982450058903A078EC70C@news.pacbell.net>#1/1 X-Deja-AN: 647718201 Content-Transfer-Encoding: 7bit References: <8kmjja$l5h$1@pollux.ip-plus.net> <3970F56F.F3A70FAD@icdc.com> Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@pacbell.net X-Trace: news.pacbell.net 963916846 63.194.212.92 (Tue, 18 Jul 2000 03:40:46 PDT) Organization: heaps of stacks User-Agent: Hogwasher 2.0 (Macintosh) MIME-Version: 1.0 NNTP-Posting-Date: Tue, 18 Jul 2000 03:40:46 PDT Newsgroups: comp.lang.ada Date: 2000-07-18T00:00:00+00:00 List-Id: 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