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-Thread: 103376,c1400b61b3f80c1e X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!postnews.google.com!u72g2000hsf.googlegroups.com!not-for-mail From: gpriv@axonx.com Newsgroups: comp.lang.ada Subject: Re: Are there noticable differences in Ada acceptance by country? Date: Thu, 20 Mar 2008 15:59:25 -0700 (PDT) Organization: http://groups.google.com Message-ID: <9adb8bbd-5058-4406-b8b9-2ccfbc141264@u72g2000hsf.googlegroups.com> References: <87d4pr6413.fsf@ludovic-brenta.org> <47e0fc15$0$89167$157c6196@dreader1.cybercity.dk> <13u2t1a2s141531@corp.supernews.com> <1fac7b25-a11f-4199-97ad-45688318e424@u69g2000hse.googlegroups.com> <1kv438li1fcvq.ox99qnglkog5.dlg@40tude.net> NNTP-Posting-Host: 69.250.188.114 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1206053966 28384 127.0.0.1 (20 Mar 2008 22:59:26 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 20 Mar 2008 22:59:26 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: u72g2000hsf.googlegroups.com; posting-host=69.250.188.114; posting-account=YaY8rAoAAAAAnFXOECY3BGVJsrvFJCgy User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20519 Date: 2008-03-20T15:59:25-07:00 List-Id: On Mar 20, 6:17 pm, Simon Wright wrote: > "Dmitry A. Kazakov" writes: > > > > > On Thu, 20 Mar 2008 20:22:22 +0000, Simon Wright wrote: > > >> gp...@axonx.com writes: > > >>> I think strong typing should not be dismissed. Unfortunately Java- > >>> based (and C/C++/C#) courses don't explain to students that X and Y > >>> coordinates being fundamentally integer (or float) types are not the > >>> same thing. > > >> I always disliked an X binding which had (sub)types for X, Y > >> coordinates. Wrong level of abstraction, I thought: use something like > > >> type Position is record > >> X : Float; > >> Y : Float; > >> end record; > > >> and you get a _lot_ less scope for confusion. > > > If no rotations involved I would suggest: > > > type Horizontal_Coordinate is new Float; > > type Vertical_Coordinate is new Float; > > type Position is record > > X : Horizontal_Coordinate; > > Y : Vertical_Coordinate; > > end record; > > > In some cases I would consider making absolute positions and relative > > offsets different types, similar to Time and Duration. > > Well, to be fair, I suppose I would have used Metres (or Pixels) > rather than plain Float. > > subtype Metres is Float; > > But I don't see the real advantage in using different types for H_C > and V_C. How ofen are users actually going to get this wrong? >From my own C experience: using code from different sources X and Y coordinates in function calls were in different order: foo(x,y); boo(height, width), etc. Easy to overlook. George. > There is > some comment-like advantage to subtyping -- rather like AdaCore's > library packages with eg > > subtype Path_Name is String; > > but full typing is only going to clutter the place up with > conversions. Or perhaps you lie to provide all the operations a person > could need (acceleration x duration -> speed etc)? > > Why would things be different if there were rotations involved?