問題です。
次のプログラムはなんと出力するでしょう。
with Text_IO; procedure eq is package pr is type T1 is record M : Integer; end record; function "=" (X, Y : T1) return Boolean; type T2 is tagged record M : Integer; end record; function "=" (X, Y : T2) return Boolean; end pr; package body pr is function "=" (X, Y : T1) return Boolean is begin Text_IO.Put_Line("primitive of T1."); return X.M = Y.M; end "="; function "=" (X, Y : T2) return Boolean is begin Text_IO.Put_Line("primitive of T2."); return X.M = Y.M; end "="; end pr; package co is type C11 is record A : pr.T1; end record; type C12 is tagged record A : pr.T1; end record; type C21 is record A : pr.T2; end record; type C22 is tagged record A : pr.T2; end record; end co; use type co.C11, co.C12, co.C21, co.C22; O11 : co.C11 := (A => (M => 1)); O12 : co.C12 := (A => (M => 1)); O21 : co.C21 := (A => (M => 1)); O22 : co.C22 := (A => (M => 1)); begin Text_IO.Put_Line("11"); declare Dummy11 : Boolean := O11 = co.C11'(A => (M => 1)); begin null; end; Text_IO.Put_Line("12"); declare Dummy12 : Boolean := O12 = co.C12'(A => (M => 1)); begin null; end; Text_IO.Put_Line("21"); declare Dummy21 : Boolean := O21 = co.C21'(A => (M => 1)); begin null; end; Text_IO.Put_Line("22"); declare Dummy22 : Boolean := O22 = co.C22'(A => (M => 1)); begin null; end; end eq;
委員会も統一と互換性の間で揺れているらしい。
http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AI05s/AI05-0123-1.TXT