Re: Records that could be arrays



Justin Gombos <rpbkbq.xax.gld@xxxxxxxx> writes:

On 2006-02-23, tmoran@xxxxxxx <tmoran@xxxxxxx> wrote:
But with
type Rows is new Local_Float;
type Cols is new Local_Float;
the compiler's type checking can point out such errors. In that case,
of course, you have to use a record

Sure, my rule wouldn't apply there because we're no longer talking
about a composite of a single element type.

Cohen uses x,y coodinates of different types as an example of over
typing. I'm kind of on the fence. I've been declaring every
dimension within a coordinate system to have the same element type
because it seems to be more of a hinderance than a benefit to seperate
them. The question is whether y is a function of x,

Or if you want the Cartesian magnitude: sqrt (x**2 + y**2). Or any
other function that involves x and y in a single expression. Like
rotation:

Rotated_Point := (a * Point (x) + b * Point (y), c * Point (x) + d *
Point (y));

which can't always be answered when the type comes into existence.

If it's a _point_, we already know about such things. If it's a
genuinely new type, yes, it might be unclear.

--
-- Stephe
.