Re: Records that could be arrays



On Fri, 24 Feb 2006 15:23:51 -0600, Randy Brukardt wrote:

Claw also has types like this:

type Point_Type is record
X, Y : Int;
end record;

type Size_Type is record
Width, Height : Int; -- Width=X_Size, Height=Y_Size.
end record;

type Rectangle_Type is record
Left, Top, Right, Bottom : Int;
end record;

That's partly because we're matching the Windows definitions for these
types, but also because these "feel" like records to me.

I think that the essential question is whether co-ordinates have the same
type. The rest is a question of language deficiency. In this case an
inability to provide an array interface to a record type (to have
enumerated components), or a record interface to an array (to have named
components.)

It looks logical to choose the same type for all co-ordinates. However for
a teletype display they probably should be different. There is a subtler
question whether absolute co-ordinates and distances should of the same
type. Sort of, whether the relativity theory applies to GUI... (:-))

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.