From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Records that could be arrays
Date: Mon, 27 Feb 2006 10:33:32 +0100
Date: 2006-02-27T10:33:32+01:00 [thread overview]
Message-ID: <1wqy0gd59rfd2.oi6ujflicahw$.dlg@40tude.net> (raw)
In-Reply-To: 1141007203.046035.264640@i39g2000cwa.googlegroups.com
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
next prev parent reply other threads:[~2006-02-27 9:33 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-23 4:11 Records that could be arrays Justin Gombos
2006-02-23 4:51 ` tmoran
2006-02-23 13:19 ` Justin Gombos
2006-02-24 10:19 ` Stephen Leake
2006-02-23 6:32 ` Wilhelm Spickermann
2006-02-23 13:08 ` Stephen Leake
2006-02-23 13:20 ` Justin Gombos
2006-02-23 14:29 ` Wilhelm Spickermann
2006-02-24 10:31 ` Stephen Leake
2006-02-26 22:34 ` Wilhelm Spickermann
2006-02-23 8:21 ` john Doef
2006-02-23 9:22 ` Jean-Pierre Rosen
2006-02-23 13:11 ` Stephen Leake
2006-02-23 13:37 ` Justin Gombos
2006-02-23 13:06 ` Stephen Leake
2006-02-23 20:23 ` Simon Wright
2006-02-24 21:23 ` Randy Brukardt
2006-02-25 11:39 ` Dmitry A. Kazakov
2006-02-26 3:24 ` Steve Whalen
2006-02-26 9:51 ` Dmitry A. Kazakov
2006-02-27 2:26 ` Steve Whalen
2006-02-27 9:33 ` Dmitry A. Kazakov [this message]
2006-03-01 22:44 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox