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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,31982f45a4d88565 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-01 05:39:49 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!crtntx1-snh1.gtei.net!lsanca1-snf1!news.gtei.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3B178027.BA1CBB00@earthlink.net> From: "Marc A. Criley" Organization: Quadrus Corporation X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: A Record Interpretation of an Array References: <3B12C9E0.5E9B06C8@earthlink.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 01 Jun 2001 12:39:48 GMT NNTP-Posting-Host: 158.252.122.236 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 991399188 158.252.122.236 (Fri, 01 Jun 2001 05:39:48 PDT) NNTP-Posting-Date: Fri, 01 Jun 2001 05:39:48 PDT X-Received-Date: Fri, 01 Jun 2001 05:37:57 PDT (newsmaster1.prod.itd.earthlink.net) Xref: archiver1.google.com comp.lang.ada:7965 Date: 2001-06-01T12:39:48+00:00 List-Id: Mark wrote: > > "Marc A. Criley" wrote in message > news:3B12C9E0.5E9B06C8@earthlink.net... > > > > > (In case someone asks, "What problem are you actually trying to solve > > here?" The answer is, to manipulate an array via a record-oriented > > approach. I have a lot of code that does varied and sundry things with > > record definitions, and by considering an array as a degenerate case of > > a record (the fields are all of the same, rather than different, types), > > I can reuse that code to do the exact same kinds of things to arrays > > that I already do to records.) > > OK, then it seems like what you Really Want To Do :-) is to decouple your > algorithms from data representations. This can be done in very lightweight > ways, and the result is something that is absolutely clear in its intent and > does not depend upon any unchecked programming or other monkey business. > > The idea is "abstract, then fulfill the abstractions" as opposed to "pretend > it's something else that is equivalent." > > How about an example? Can you put up some code for some of the "varied and > sundry things" that you would like to be able to reuse, and then we can see > how that might be rewritten to be reusable?(The coercion approach seems like > an attempt to reuse stuff that was not written to be reusable in the first > place). I know what you're saying here, and in 99+% of applications the decoupling and abstraction would be done just as you describe. What I've got here, though, is a low-level debugging aid that directly manipulates raw byte streams, and is therefore intimately concerned with the layout of data, whether it be scalars, records, or arrays. In a sense, a "record" _is_ an abstraction of the byte stream (step away for a moment from the concept of a physical Ada record--to the idea of a record as an abstract collection of information). I have software that interprets the contents of the byte stream as this kind of abstract record, which of course maps well to the bytes associated with a physical record. So the question then concerns the reasonableness of mapping a physical Ada array to this same abstract record--with the record fields representing array elements. Marc