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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11232c,59ec73856b699922 X-Google-Attributes: gid11232c,public X-Google-Thread: 103376,583275b6950bf4e6 X-Google-Attributes: gid103376,public X-Google-Thread: fdb77,5f529c91be2ac930 X-Google-Attributes: gidfdb77,public X-Google-Thread: 1108a1,59ec73856b699922 X-Google-Attributes: gid1108a1,public X-Google-ArrivalTime: 2003-05-01 20:27:07 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.airnews.net!cabal12.airnews.net!usenet From: "John R. Strohm" Newsgroups: comp.lang.java.advocacy,comp.object,comp.lang.ada,misc.misc Subject: Re: Using Ada for device drivers? (Was: the Ada mandate, and why it collapsed and died) Date: Thu, 1 May 2003 22:05:33 -0500 Organization: Airnews.net! at Internet America Message-ID: <4F03C83A9C6A478F.688C62D70A2EADA3.068FE6EB5E241C3B@lp.airnews.net> X-Orig-Message-ID: References: <9fa75d42.0305011727.5eae0222@posting.google.com> X-A-Notice: References line has been trimmed due to 512 byte limitation Abuse-Reports-To: abuse at airmail.net to report improper postings NNTP-Proxy-Relay: library1-aux.airnews.net NNTP-Posting-Time: Thu May 1 22:24:29 2003 NNTP-Posting-Host: !]6o&1k-Vpo[@P- (Encoded at Airnews!) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Xref: archiver1.google.com comp.lang.java.advocacy:63022 comp.object:62518 comp.lang.ada:36833 misc.misc:13884 Date: 2003-05-01T22:05:33-05:00 List-Id: "soft-eng" wrote in message news:9fa75d42.0305011727.5eae0222@posting.google.com... > mcq95@earthlink.net (Marc A. Criley) wrote in message news:<254c16a.0305011035.13133e8d@posting.google.com>... > > > Ada is a language whose definition is built around the concept of a > > "type model". > > Yes, it used the then modern concepts of type definition. > (Later superseded by notions of object-oriented type definitions.) Not superseded, extended. > > Now for a comparable properly defined Ada type, one has the following: > > > > - The first and last values ('First and 'Last) > > - Access to the previous and next valid values ('Pred and 'Succ) > > - Conversion of the type to a string--without having to know its > > size or whether it's floating, numeric, or enumeration ('Image > > and 'Wide_Image) > > - The maximum number of characters such a string representation can > > take ('Width and 'Wide_Width) > > - Ability to convert a string representation of that type--whatever > > kind it is--back to a value--with range checking! ('Value, > > 'Wide_Value) > > - The number of bits required to hold the type's largest value ('Size) > > > > If you have a variable of that type, at the very least you get: > > - The number of bits actually allocated for that value ('Size) > > - It's address ('Address) > > Yes, Ada extended Pascal very strongly in this regards, > without any particular consideration of how useful > these extensions would actually turn out to be. Actually, it turns out that those extensions proved to be quite useful. 'first and 'last are necessary if you want to write loops over an arbitrary index type. 'succ and 'pred are absolutely critical if you want to step from one enumerated value to another. Conversion to/from string form is just sprintf() in a cleaner form. 'size is critical, for the same reason that sizeof() is critical. > > If you know a little bit more about your type, specifically whether > > it's a discrete or floating point type, what else do you get with > > C/C++? Nothing. > > > > With Ada (discrete): > > - 'Pos, the ordinal position of an enumeral (or number) > > - 'Val, convert an ordinal position into a value of the type > > > > (floating): > > - 'Machine_Mantissa > > - 'Machine_Radix > > and it goes on... > > > > (And yes, one could write a CAltitude class that provides all this > > information, but one would have to implement and debug > > _all_of_those_functions. In Ada you write: > > > > type Altitude is digits 6.0 range -100.0 .. 50_000.0; > > > > and you get access to all that information for free!) > > Like I said, Ada has amazing amounts of itsy-bitsy stuff. > Now which of these features, if missing, would take you > more than a minor effort to provide yourself? If and > when necessary, rather than present by default all the time? The key is that, by putting them in the language, it is absolutely guaranteed that they will be implemented CORRECTLY, every time, with NO programmer workload involved. And the actual executable code for the feature may not actually be present in the final system. It is utterly trivial to hide those features under an external name interface, and let the linker cull out unused items. (This USED to be standard behavior for linkers, back before memories got "large" and utility programmers got criminally lazy.) For some reason, linkers used by common C toolsets generally don't bother to do this: they treat executables as shovelware repositories. > > understood the motivation for, and power of, strong typing (such as it > > is in C++, Java, or Ada) much better software would get written, and > > the "best" programmers wouldn't be struggling to work around it. > > You misunderstand. Nobody needs to "work around" the type-safety > of C++ or Java. Though this was a problem with Pascal, which > was the premier contender at one time. The need to "work around" > Pascal's type safety was a big problem, and that helped C become > much more popular. Ada didn't just inherit Pascal's problems, > it enthusiastically extended them. Observe that there is actually relatively little difference between the basic type system enforced by PASCAL and the basic type system enforced by C++. I can't speak to Java. The C hackers (I hesitate to dignify them with the term "programmers") screamed bloody murder about the strong typing in PASCAL and Ada. When C++ came out, and it was strongly typed, the silence from that corner of the auditorium was absolutely deafening. > The type safety in C++ and therefore in Java has evolved slowly > and naturally. Hardly. Stroustrup took type safety in C++ from Simula 67, which actually predated PASCAL. And note that Stroustrup himself admits that adding strong typing to C was one of his earliest goals for C++.