[comp.lang.ada] Conformance rules question

bs@augusta.UUCP (Burch Seymour) (04/27/88)

In the following code package paramtest will compile without error
even though the string initialization values in the spec and body
do not match. Package paramtest2, which uses an integer argument
with different values will fail. What is the rational behind this?

--------------------------------------------------------------
package paramtest is
  procedure string_in ( a_string : in string := "default value");
end paramtest;

package body paramtest is
  procedure string_in ( a_string : in string := "other default value") is
    begin
     null;
  end string_in;
end paramtest;

package paramtest2 is
  procedure integer_in ( an_integer : in integer := 15 );
end paramtest2;

package body paramtest2 is
  procedure integer_in ( an_integer : in integer := 25 ) is
    begin
     null;
  end integer_in;
end paramtest2;

firth@sei.cmu.edu (Robert Firth) (04/28/88)

In article <1103@augusta.UUCP> bs@augusta.UUCP (Burch Seymour) writes:
  In the following code package paramtest will compile without error
  even though the string initialization values in the spec and body
  do not match. Package paramtest2, which uses an integer argument
  with different values will fail. What is the rational behind this?
  
  --------------------------------------------------------------
  package paramtest is
    procedure string_in ( a_string : in string := "default value");
  end paramtest;
  
  package body paramtest is
    procedure string_in ( a_string : in string := "other default value") is
      begin
       null;
    end string_in;
  end paramtest;

There is no rationale; this is a compiler bug.  [RM 6.3.1] gives the
rules that permit the two specifications to differ, and the kind of
difference shown here is not allowed by them.