comp.lang.ada
 help / color / mirror / Atom feed
From: "Marc A. Criley" <mcqada@earthlink.net>
Subject: Re: A Record Interpretation of an Array
Date: Fri, 01 Jun 2001 12:39:48 GMT
Date: 2001-06-01T12:39:48+00:00	[thread overview]
Message-ID: <3B178027.BA1CBB00@earthlink.net> (raw)
In-Reply-To: B7BR6.89883$p33.1865700@news1.sttls1.wa.home.com

Mark wrote:
> 
> "Marc A. Criley" <mcqada@earthlink.net> 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



  parent reply	other threads:[~2001-06-01 12:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-28 22:53 A Record Interpretation of an Array Marc A. Criley
2001-05-29  3:29 ` Jeffrey Carter
2001-05-29 13:34 ` Ted Dennison
2001-05-29 14:16 ` Marin David Condic
2001-05-31  0:55 ` Keith Thompson
2001-05-31 12:47   ` Marc A. Criley
2001-06-01  1:22     ` Keith Thompson
2001-06-01  0:14 ` Mark
2001-06-01  8:45   ` Ehud Lamm
2001-06-01 12:39   ` Marc A. Criley [this message]
2001-06-01 18:20     ` Tucker Taft
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox