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: f43e6,899fc98b2883af4a X-Google-Attributes: gidf43e6,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-20 00:34:06 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: martin.dowie@btopenworld.com (Martin Dowie) Newsgroups: comp.lang.java.advocacy,comp.object,comp.lang.ada,comp.software-eng Subject: Re: Logic Errors and Ada (Was: A big hairy thread on Ada, Quality, and Drivers) Date: 20 May 2003 00:34:05 -0700 Organization: http://groups.google.com/ Message-ID: References: <9fa75d42.0304230424.10612b1a@posting.google.com> <9fa75d42.0305141747.5680c577@posting.google.com> <1053027582.984315@master.nyc.kbcfp.com> <3ec4b5c5$1@news.wineasy.se> <254c16a.0305160930.40bb42f9@posting.google.com> <9fa75d42.0305181502.53703035@posting.google.com> NNTP-Posting-Host: 20.138.254.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1053416045 24233 127.0.0.1 (20 May 2003 07:34:05 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 20 May 2003 07:34:05 GMT Xref: archiver1.google.com comp.lang.java.advocacy:64238 comp.object:63738 comp.lang.ada:37550 comp.software-eng:19310 Date: 2003-05-20T07:34:05+00:00 List-Id: Simon Wright wrote in message news:... > My project is using 'subtype Radians is Long_Float' or equivalent, > with constraints occasionally (though personally I don't now think > that Radians can sensibly be constrained without a lot of work). Of > course Latitude could be. The trouble is that the constraints won't > catch that may errors (in UK waters, anyway). True - but we tend to have whole-world-coverage type requirements. It wouldn't be unusual to find something like: type A_Degree is digits 15; type A_Latitude is private; type A_Longitude is private; function To_Latitude (D : A_Degree) return A_Latitude; function To_Longitude (D : A_Degree) return A_Longitude; private type A_Latitude is new A_Degree range -90.0 .. 90.0; type A_Longitude is new A_Degree range -180.0 .. A_Degree'Pred (180.0); in our code. Given that the algorithms are as old as the sun (e.g. great circle) the number of times you actually need to do calculations with both lat and long are fairly rare, so the type conversion just are much of a hassle. > I've always thought that the pain of introducing full dimensional > handling (without language support) is unjustifiable, and that if We only define what we need. As I mentioned at AdaUK, I've tried greating *all* combinations before and the text editor just exploded! :-) > necessary one should rather go for records in this context: > > type Position is record > Lat : Latitude; > Long : Longitude; > end record; > > and inspect the low-level support subprograms. ...and a surprisingly similar... type A_Coordinate is record Lat : A_Latitude; Long : A_Longitude; end record;