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!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newspeer.monmouth.com!nntp.abs.net!news.abs.net!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Records that could be arrays References: From: Stephen Leake Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:KqgL8XMn3GdDHiq4cOW0wIB/+U4= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 24 Feb 2006 05:31:29 -0500 NNTP-Posting-Host: 66.159.65.1 X-Complaints-To: abuse@toad.net X-Trace: news.abs.net 1140777098 66.159.65.1 (Fri, 24 Feb 2006 05:31:38 EST) NNTP-Posting-Date: Fri, 24 Feb 2006 05:31:38 EST Xref: g2news1.google.com comp.lang.ada:3125 Date: 2006-02-24T05:31:29-05:00 List-Id: Wilhelm Spickermann writes: > This becomes also visible in the missing loop statements in > typical polar coordinate operations. And it would be rather > unusual for an array to have a special equality definition Perhaps it is "unusual" in your experience because you are overly restrictive in using arrays for such types. Having said that, I don't think I've ever overridden equality for an array. But I rarely override equality for any type, so that's not a good measure. > while it is rather normal for a record (phi is "dont care" when > theta is zero -- or AFAIK the other way round in North America). Right. So if we are using an array to represet these coordinates, we would override equality for that type. Ada lets us do that, so there is (by definition :) nothing "wrong" with it! Equal rights for arrays :). I see this as similar to a discussion of implementation for a container. At a high level, we don't care whether a "set" is implemented as an array of bits or a list of some sort. At a lower level, we do, and we ask "what is the implementation that gives the fastest execution time" or similar questions. At a high level, a "point" is an abstract object, and we don't care about the representation. At the low level, we ask "would it ever be convenient to use a loop to process the elements of this type". If the answer is 'yes', we use an array. What I have been saying is that the answer is almost always 'yes', when you consider operations like Text_IO and AUnit checks. If we implemented points as limited private types, we wouldn't be having this discussion. But writing access functions instead of just using Ada syntax is "obviously" too heavy for points, so we make them public types. But the priciple still applies; the implementation of the type is logically separate from the abstract interface of the type. -- -- Stephe