MODULE A;
TYPE
Proc = PROCEDURE;
PROCEDURE Test1 (): BOOLEAN;
VAR
P1, P2: PROCEDURE;
BEGIN
RETURN P1 = P2; (* ok *)
END Test1;
PROCEDURE Test2 (): BOOLEAN;
VAR
P1: PROCEDURE;
P2: PROCEDURE;
BEGIN
RETURN P1 = P2; (* error *)
END Test2;
PROCEDURE Test3 (): BOOLEAN;
VAR
P1: Proc;
P2: Proc;
BEGIN
RETURN P1 = P2; (* ok *)
END Test3;
END A.
I don't see any error. It is perfectly alright.
You have the same behaivor with RECORDs when they declared directly and not via TYPE definition.
It is not a bug.
- Helmut
This is the intended behavior.
It gives you more control about what is compatible and what is not compatible.
A complex number, for example, could be represented using cartesian or polar coordinates.
Both have two REAL components but they are very different.
Structural equivalence would treat them as compatible, but name equivalence allows
you make them two incompatible types.
Josef Templ wrote:This is the intended behavior.
It gives you more control about what is compatible and what is not compatible.
A complex number, for example, could be represented using cartesian or polar coordinates.
Both have two REAL components but they are very different.
Structural equivalence would treat them as compatible, but name equivalence allows
you make them two incompatible types.