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!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 22 Feb 2006 22:51:57 -0600 From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Records that could be arrays References: X-Newsreader: Tom's custom newsreader Message-ID: Date: Wed, 22 Feb 2006 22:51:57 -0600 NNTP-Posting-Host: 67.169.16.3 X-Trace: sv3-3lu1hQB1O5V54cNwXUInVmXcm9w+/fZDtTVE6DuEGZmvtUs0fhg2QbGgJHZVMUJkTUePn/hnAKXL2dn!CsqB/s5mvVgz/ETUTnNpsoKw/z68jwPQrnG09WaQylHpn/h9YIz9Px+d1GcCOp6nG3zqfcal5VQ= X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.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:3090 Date: 2006-02-22T22:51:57-06:00 List-Id: > type Coordinate is > record > Row : Local_Float; > Column : Local_Float; > end record; In mathematics, one usually gives a coordinate as (x,y), while in graphics it's often (vertical, horizontal). Inadvertently switching the order can be an annoying bug. But with type Rows is new Local_Float; type Cols is new Local_Float; the compiler's type checking can point out such errors. In that case, of course, you have to use a record with Row : Rows; Column : Cols; and cannot use an array. If your code might one day have to accomodate 3-D coordinates, then for A in Axis loop Sum := Sum + V(A)**2; needs no change, while Sum := V.Row**2 + V.Column**2; will need a makeover, and thus is much less desirable. The general point is that sometimes an array fits the problem better and sometimes a record fits it better. A rule that says "hey, they're all Local_Float so it should be an array" is much too limiting.