comp.lang.ada
 help / color / mirror / Atom feed
From: harrison@software.ORG (Tim Harrison)
Subject: Re: Visibility question
Date: 15 Sep 88 20:36:42 GMT	[thread overview]
Message-ID: <8809160044.AA20507@ajpo.sei.cmu.edu> (raw)

>> In article <2223@ssc-vax.UUCP>, adolph@ssc-vax.UUCP (Mark C. Adolph) writes:
>> Given the following package specs, I'm getting errors which I'm
>> confused about:
>> 
>>  1  package Test_Pack_One is
>>  2  
>>  3      type Enum_Type is (one, three, five, seven, nine);
>>  4  
>>  5  end Test_Pack_One;
>>  6
>>  7  with Test_Pack_One;
>>  8  package Test_Pack_Two is
>>  9  
>> 10      subtype Enum_Type is Test_Pack_One.Enum_Type;
>> 11  
>> 12      first_enum  : Enum_Type := three;
>> 13      second_enum : Enum_Type := Enum_Type'(three);
>> 14      third_enum  : Test_Pack_One.Enum_Type := 
>> 15  		    Test_Pack_One.Enum_Type'(three);
>> 16  
>> 17  end Test_Pack_Two;

Two solutions without a USE clause were provided by Fred Hosch
<fred@cs.utexas.edu>.  Another possible solution is:

        package Test_Pack_One is
          type Enum_Type is (one, three, five, seven, nine);
        end Test_Pack_One;

        with Test_Pack_One;
        package Test_Pack_Two is
            subtype Enum_Type is Test_Pack_One.Enum_Type;
            function three return Test_Pack_One.Enum_Type
                renames Test_Pack_One.three;

            first_enum : Enum_Type := three;
        end Test_Pack_Two;

-- Tim Harrison
Software Productivity Consortium  Phone:   (703) 391-1742
1880 Campus Commons Drive, North  CSnet:   harrison@software.org
Reston, Virginia  22091           ARPAnet: harrison@ajpo.sei.cmu.edu

             reply	other threads:[~1988-09-15 20:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1988-09-15 20:36 Tim Harrison [this message]
  -- strict thread matches above, loose matches on Subject: below --
1988-09-14  2:53 Visibility question Mark C. Adolph
1988-09-14 15:12 ` Fred Hosch
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox