comp.lang.ada
 help / color / mirror / Atom feed
* Scope of identifiers
@ 1996-04-17  0:00 Kevin F. Quinn
  1996-04-18  0:00 ` Jon S Anthony
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin F. Quinn @ 1996-04-17  0:00 UTC (permalink / 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.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-04-18  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-04-17  0:00 Scope of identifiers Kevin F. Quinn
1996-04-18  0:00 ` Jon S Anthony

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