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,ffc9e2fe760c58fd X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Fri, 24 Feb 2006 15:19:00 -0600 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: Subject: Re: Records that could be arrays Date: Fri, 24 Feb 2006 15:23:51 -0600 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-mTiRSwQmXnFGmMc7iBj7aoLhe99eWe1WJ8PkgSnzJrS/SnplNgxB39toTlT9UV/gB4jbPu71JM/g6jD!FVdCOma2MdkESi6p6gcmp/hazOodG88FOHhNqzbzzVZgY3l/PxcwCNK2MfUfly1ZQE6a1KP8mSUu!Kc3GiIJ9/aZtkw== X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:3150 Date: 2006-02-24T15:23:51-06:00 List-Id: "Stephen Leake" wrote in message news:u8xs2xm0l.fsf@toadmail.com... > Justin Gombos writes: > > > I noticed this example code in 5.4.4 of the Ada Quality and Style > > Guide: > > > > type Coordinate is > > record > > Row : Local_Float; > > Column : Local_Float; > > end record; > > > > type Window is > > record > > Top_Left : Coordinate; > > Bottom_Right : Coordinate; > > end record; > > > > Would anyone here write something like that? > > Yes; Windex has it. Although if I was rewriting it from scratch now, > I might use an array. Claw also has types like this: type Point_Type is record X, Y : Int; end record; type Size_Type is record Width, Height : Int; -- Width=X_Size, Height=Y_Size. end record; type Rectangle_Type is record Left, Top, Right, Bottom : Int; end record; That's partly because we're matching the Windows definitions for these types, but also because these "feel" like records to me. I generally only use arrays when I'm storing a number of identical items with identical uses (although ordering may matter); "Left" and "Bottom" hardly have the same meaning or use, even though they have the same type and sometimes need to be combined. And its certainly easier to change just one if it isn't an array. Randy.