!standard 13.14 (05) 96-11-16 AI95-00040/04
!class ramification 95-06-25
!status WG9 approved 96-12-07
!status ARG approved 11-0-1 96-10-07
!status ARG approved 8-0-0 96-06-17
!status work item 95-06-25
!status received 95-06-25
!priority Low
!difficulty Easy
!subject A box for a formal subprogram_default freezes the actual
!summary 95-06-25
A box for a formal subprogram_default freezes the actual subprogram
determined in an instantiation.
!question 96-09-15
Consider:
type T is ....
type T2 is ...
function "+"(A: T; B: T2) return T;
generic
type FT is private;
with function "+"(A: FT; B: T2) return FT is <>;
package GP is ...
package IP is new GP(T);
-- does this instantiation freeze "+" and therefore T2? (Yes.)
13.14(5) doesn't cover that case.
!response 95-06-25
12.6(10) says, "If a generic unit has a subprogram_default specified by
a box, and the corresponding actual parameter is omitted, then it is
equivalent to an explicit actual parameter that is a usage name
identical to the defining name of the formal."
Thus, the instantiation GP(T) is equivalent to the instantiation GP(T, "+").
13.14(4,5,14) then demand that "+" and T2 are frozen by the
instantiation.
!appendix 95-06-25
!section 13.14(5)
!section 12.6(10)
!subject Does <> for a formal subprogram default freeze the actual ?
!reference RM95-13.14(5)
!from Erhard Ploedereder 4-11-95
!keywords freezing
!reference as: 95-5120.a Erhard Ploedereder 95-4-10>>
!discussion
Consider:
type T is ....
type T2 is ...
function "+"(A: T; B: T2) return T;
generic
type FT is private;
with function "+"(A: FT; B: T2) return FT is <>;
package GP is ...
package IP is new GP(T); -- does this freeze "+" and therefore T2 ?
I presume this is intended, but 13.14(5) doesn't cover that case.
****************************************************************
!section 13.14(5)
!section 12.6(10)
!subject Does <> for a formal subprogram default freeze the actual ?
!reference RM95-13.14(5)
!reference RM95-12.6(10);6.0
!reference 95-5120.a Erhard Ploedereder 4-11-95
!keywords freezing
!from Tucker Taft 95-04-11
!reference as: 95-5121.a Tucker Taft 95-4-11>>
!discussion
> Consider:
>
> type T is ....
> type T2 is ...
> function "+"(A: T; B: T2) return T;
>
> generic
> type FT is private;
> with function "+"(A: FT; B: T2) return FT is <>;
> package GP is ...
>
> package IP is new GP(T); -- does this freeze "+" and therefore T2 ?
Yes.
> I presume this is intended, but 13.14(5) doesn't cover that case.
Per 12.6(10), the instantiation GP(T) is equivalent to the
instantiation GP(T, "+").
Of course, we all know that "equivalent" generally means
"similar to but not exactly the same in some confusing way"
but at least in this case, the intent was that they really
are equivalent! At least a NOTE would help here I suppose to
make it clear that the "equivalence" is really an equivalence.
-Tuck
****************************************************************