Version 1.1 of acs/ac-00166.txt

Unformatted version of acs/ac-00166.txt version 1.1
Other versions for file acs/ac-00166.txt

!standard 3.9(4/2)          08-08-08 AC95-00166/01
!class confirmation 08-08-08
!status received no action 08-08-08
!status received 08-05-19
!subject Recursion and tag equality
!summary
!appendix

!topic Recursion and tag equality
!reference 3.9
!from Adam Beneschan 08-05-15
!discussion


I'm just double-checking my understanding of what the RM says about the 'Tag
attribute when applied to recursive instances of the "same" type at different
levels.  Assume the following is in the body of a library package.

    type Root is tagged null record;

    Tag_Array : array (1 .. 2) of Ada.Tags.Tag;

    procedure Recursive (N : Integer) is

        type Child is new Root with record
            F1 : Integer;
        end record;

    begin
        Tag_Array (N) := Child'Tag;
        if N > 1 then
            Recursive (N - 1);
        end if;
    end Recursive;

    procedure Test is
        use type Ada.Tags.Tag;
    begin
        Recursive (2);
        Text_IO.Put_Line (Boolean'Image (Tag_Array(1) = Tag_Array(2)));
    end Test;

Is the output of the Test procedure TRUE, FALSE, or unspecified by the language?

****************************************************************

From: Tucker Taft
Date: Monday, May 19, 2008  9:40 PM

RM and AARM Paragraphs 3.9(4,4.a-4.c) make it pretty clear that the tag needs to
distinguish between all ancestors of the same type that are simulataneously
"active." Hence the tags in each recursive invocation of Recursive must be
distinct.  Hence the output must be "FALSE."

****************************************************************

Questions? Ask the ACAA Technical Agent