This one is really curious, if you declare:
PROCEDURE Q3 (IN v: ARRAY 3 OF REAL); BEGIN END Q3;
The compiler accepts it, but there is no valid call to this procedure, it becomes perfectly useless.
René Dorta.
On Wed, Mar 31, 2010 at 9:23 PM, Douglas G. Danforth <danforth{([at]})nowhere.xy
Folks,
I don't understand this.
If I define a procedure that takes an ARRAY OF REAL and
pass it an row of a matrix then that works BUT if I specialize
the procedure to take an ARRAY 3 OF REAL and pass it a
row of a matrix ARRAY 3,3 OF REAL then the compiler complains.
TYPE
VDesc = ARRAY OF REAL;
V3Desc = ARRAY 3 OF REAL;
MDesc = ARRAY OF ARRAY OF REAL;
M3Desc = ARRAY 3,3 OF REAL;
PROCEDURE Q (IN v: VDesc); BEGIN END Q;
PROCEDURE Q3 (IN v: V3Desc); BEGIN END Q3;
PROCEDURE Test;
VAR m3: M3Desc;
BEGIN
Q(m3[0]); (* works *)
Q3(m3[0]) (* fails! incompatible assignment *)
END Test;
The "slice" m3[0], which is the first row of m3, is accepted by a routine
that accepts general non specific vectors but that same slice which
has length 3 is rejected by a routine that wants vectors of length 3.
Why?
I really don't understand the strong typing in this case.
-Doug Danforth
---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
Received on Tue May 04 2010 - 22:23:10 UTC