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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3885b7fd66a1db28 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-10 07:51:16 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: kcline17@hotmail.com (Kevin Cline) Newsgroups: comp.lang.ada Subject: Re: Why is Ada NOT a good choice for a beginner to programming? Date: 10 Jan 2003 07:51:15 -0800 Organization: http://groups.google.com/ Message-ID: References: NNTP-Posting-Host: 24.219.89.90 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1042213876 19344 127.0.0.1 (10 Jan 2003 15:51:16 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 10 Jan 2003 15:51:16 GMT Xref: archiver1.google.com comp.lang.ada:32888 Date: 2003-01-10T15:51:16+00:00 List-Id: "Grein, Christoph" wrote in message news:... > > > One complaint he had was that it be possible to define a Length > > > using derived types and still have "*" return values of type Length, > > > when it should return an area. He had a point, hadn't he? > > > OTOH, with only structural equivalence of types, and no way to derive > > > both an integral length type and an integral area type, that are really > > > diferent, how can you build areas into your types, such that the compiler > > > will prevent use of values of the wrong type? > > > > > > In which languages has this been fixed? > > > > This is relatively easy to do in C++. > > See http://www.fnal.gov/docs/working-groups/fpcltf/html/SIunits-summary.html > > This is also easy in Ada. > > For a collection of methods how to deal with dimensions in Ada, see > Did you read Grein's paper? He says that it was not easy at all. Grein writes: But the request to have full dimensional checking persists as can be seen from the pertinent discussions in newsgroup Comp.Lang.Ada. There are two basic ways one can try to solve the problem, either by adding to the numeric value its dimension as attribute, or by using different types for different dimensions. Since the first method is runtime-consuming, whereas the second one is only compiletime-consuming, all effort naturally concentrates on the second method. This is doomed to fail as is shown in the paper cited above - although a plethora of overloaded operations is used, the result is not really satisfactory. Physical equations with all their powers and roots evade these attempts. In short, Ada's requirement for explicit generic instantiation repels attempts to create a compile-time verified system of dimensional types, and Grein gave up on attempts to achieve compile-time type safety. C++ does not have this problem, and compile-time type safety is achieved in a fairly obvious way.