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 11:00:38 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 11:00:37 -0800 Organization: http://groups.google.com/ Message-ID: References: NNTP-Posting-Host: 192.76.54.20 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1042225237 2695 127.0.0.1 (10 Jan 2003 19:00:37 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 10 Jan 2003 19:00:37 GMT Xref: archiver1.google.com comp.lang.ada:32892 Date: 2003-01-10T19:00:37+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 > Christopher, I apologize for not noticing that you were referring to your own paper. But in the paper you mention numerous shortcomings of the implementation: "Ada is not suited to handling physical dimensions!" and ...we can include semantic information within variable declarations... g: Meter_Per_Second_2 := 9.81; t: Second := 10.0; s: Meter := 0.5 * g * t**2; It is the programmer's own responsibility that this formula is physically correct, no type checking is done! ...There is one service restriction: Checks in assignments concerning physical dimensions are not performed. The C++ solution affords full compile-time checking of assignments, and will not allow a quantity of one dimensionality to be assigned to a variable of another dimensionality except by resorting to a reinterpret-cast.