From: fred@cs.utexas.edu (Fred Hosch)
Subject: Re: Visibility question
Date: 14 Sep 88 15:12:48 GMT [thread overview]
Message-ID: <3326@cs.utexas.edu> (raw)
In-Reply-To: 2223@ssc-vax.UUCP
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;
...
LRM 3.5.1 states "this declaration (of an enumeration literal) is
equivalent to the declaration of a parameterless function..." Either
of the following will do without a use-clause:
package TEST_PACK_ONE is
type ENUM_TYPE is (ONE, THREE, FIVE, SEVEN);
end TEST_PACK_ONE;
with TEST_PACK_ONE;
package TEST_PACK_TWO is
subtype ENUM_TYPE is TEST_PACK_ONE.ENUM_TYPE;
FIRST_ENUM: ENUM_TYPE := TEST_PACK_ONE.THREE;
end TEST_PACK_TWO;
or
package TEST_PACK_ONE is
type ENUM_TYPE is (ONE, THREE, FIVE, SEVEN);
end TEST_PACK_ONE;
with TEST_PACK_ONE;
package TEST_PACK_TWO is
type ENUM_TYPE is new TEST_PACK_ONE.ENUM_TYPE;
FIRST_ENUM: ENUM_TYPE := THREE;
end TEST_PACK_TWO;
--- Fred Hosch
fred@cs.utexas.edu
next prev parent reply other threads:[~1988-09-14 15:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1988-09-14 2:53 Visibility question Mark C. Adolph
1988-09-14 15:12 ` Fred Hosch [this message]
-- strict thread matches above, loose matches on Subject: below --
1988-09-15 20:36 Tim Harrison
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox