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,ffc9e2fe760c58fd X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news1.google.com!atl-c05.usenetserver.com!news.usenetserver.com!news-out.octanews.net!teal.octanews.net!statler.nntpserver.com!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Records that could be arrays Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.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: <189zs75645p7g.1usdp56yox0lg$.dlg@40tude.net> <1140924272.052117.106800@u72g2000cwu.googlegroups.com> <1141007203.046035.264640@i39g2000cwa.googlegroups.com> Date: Mon, 27 Feb 2006 10:33:32 +0100 Message-ID: <1wqy0gd59rfd2.oi6ujflicahw$.dlg@40tude.net> NNTP-Posting-Date: 27 Feb 2006 10:33:32 MET NNTP-Posting-Host: 5f6b38c1.newsread2.arcor-online.net X-Trace: DXC=JaU43?SP1C3OjE[7VlJ2<0Q5U85hF6f;4jW\KbG]kaM8Qc4L4[MA2T0UJcQQPnnkk=[6LHn;2LCV>7enW;^6ZC`4IXm65S@:3>? X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:3181 Date: 2006-02-27T10:33:32+01:00 List-Id: On 26 Feb 2006 18:26:43 -0800, Steve Whalen wrote: > I don't think I'd want Ada to have a facility to do array and record > overlays beyond what exists (in the example I gave), because to me > arrays and records are NOT synonymous. I can't think of a single "real > world" example where the use of the data and the nature of the data in > the application didn't clearly suggest that either it was fundamentally > an array or a record. Consider a linear algebra library. Aren't matrices arrays? Good. Aren't sparse matrices arrays? Hmm. Interface /= implementation. I was talking about array interface. The implementation of the interface can be any. > I guess that part of the reason I don't want this feature is because I > agree with with Jean-Pierre Rosen's statement that arrays are really > for iterative structures, so I don't see much need for this since most > of the various types of examples given in this thread are clearly (to > me) more safely and properly defined as records. Defined /= declared > I don't know that I'd want to burden the compiler with trying to ensure > that an array and record had bit equal representation clauses either > given or implied before allowing such an overlay. If equal internal > representation is NOT the case, I'd hate to think of the inefficiency > of a program using both "array style" AND "record style" access code > with the compiler having to do a lot of "conversion" of representation > in order to support the hypothesized "overlay" facility. There is no any burden for the compiler, because it is up to the programmer to implement the interface. There is a definite burden for the language designers to unify the type system and language syntax. > Ada compilers have enough to keep straight already. Or at least I don't > see enough utility in such a feature to justify the added complexity. > Of course I may be misunderstanding what array/record overlay facility > you have in mind. What I mean is: type Sparse_Matrix is private array (...) of ...; private type Sparse_Matrix is tagged record ...; -- Here the compiler will politely ask me to provide an implementation -- of access to element primitive operations of Sparse_Matrix. or type Joystick is private record X : Integer; Y : Integer end record; private task type Joystick is ...; -- Here I will be required to provide access to components methods, -- which I will implement via rendezvous! (:-)) Ada should finally get ADTs right! -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de