From: "Kevin F. Quinn" <kevq@banana.demon.co.uk>
Subject: Scope of identifiers
Date: 1996/04/17
Date: 1996-04-17T00:00:00+00:00 [thread overview]
Message-ID: <3174F2AF.1C4@banana.demon.co.uk> (raw)
Is there a way (I've looked and can't find one) of informing an Ada compiler that
a prefix is a package? The following (contrived) code example illustrates:
package Pong is
procedure Neutralise;
end Pong;
with Pong;
procedure OdourControl is
type Smells is (Pong, Whiff);
Smell : Smells;
begin
Smell := Pong;
Pong.Neutralise;
end OdourControl;
Now; as a human, I can identify immediately that "Pong.Neutralise" is intended to mean
"call procedure Neutralise from package Pong". Unfortunately, the above code generates
a semantic error, as when parsing the "Pong.Neutralise", the meaning of Pong is taken
to be that of the enumeration literal, which is eclipsing the package Pong.
If it were the other way round, where the package name were in the more immediate
scope, one could write Smells'Pong to get at the enumeration literal. Is there
anything similar which can explicitly tell the compiler that an identifier is a
package?
As an aside, are there any situations where an enumeration literal makes any sense
at all as an lvalue? I can't think of any...
Cheers,
Kev.
next reply other threads:[~1996-04-17 0:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-04-17 0:00 Kevin F. Quinn [this message]
1996-04-18 0:00 ` Scope of identifiers Jon S Anthony
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox