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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Are there noticable differences in Ada acceptance by country? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH 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> Date: Thu, 20 Mar 2008 21:48:14 +0100 Message-ID: <1kv438li1fcvq.ox99qnglkog5.dlg@40tude.net> NNTP-Posting-Date: 20 Mar 2008 21:48:16 CET NNTP-Posting-Host: 5b251d1b.newsspool4.arcor-online.net X-Trace: DXC=RV0hYoHoAC4gP]QSEBQ^d44IUK2UDH0aM^2R8;[6LHn;2LCV>[ On Thu, 20 Mar 2008 20:22:22 +0000, Simon Wright wrote: > gpriv@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. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de