comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: Boolean Operation on pointer (access)
Date: Sun, 27 Oct 2002 02:17:55 GMT
Date: 2002-10-27T02:17:55+00:00	[thread overview]
Message-ID: <3DBB4CF3.5020402@acm.org> (raw)
In-Reply-To: mailman.1035681962.10485.comp.lang.ada@ada.eu.org

Dominic D'Apice wrote:
> Ok then, i use the clause use in my .ada for my package ads, it's
> working, 
> but i don't understand why i need to put a use clause for only this king
> of operator ?
> 
> For the rest of my .ada program  i only precede each thing by the .ads
> package name 
> Ex : package.var := xxx;

The things in a package mentioned in a context clause ("with") are not 
directly visible. This means you have to precede them with the package 
name to reference them.

You can make everything in a package directly visible by naming the 
package in a use clause. Instead of

X : Package_Name.Var;

X := Package_Name."+" (X, 1);

you can have

use Package_Name;

X : Var;

X := X + 1;

This is not always desirable. To only make the operators of a specific 
type from the package visible, you can name the type in a "use type" clause:

use type Package_Name.Var;

X : Package_Name.Var; -- "Package_Name." needed here

X := X + 1; -- "+" is an operator for Var, so not needed here

-- 
Jeff Carter
"Why don't you bore a hole in yourself and let the sap run out?"
Horse Feathers




      parent reply	other threads:[~2002-10-27  2:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-26 23:15 Boolean Operation on pointer (access) Dominic D'Apice
2002-10-27  1:07 ` Robert A Duff
2002-10-27  1:26   ` Dominic D'Apice
2002-10-27  2:02     ` Robert A Duff
2002-10-27  2:17     ` Jeffrey Carter [this message]
replies disabled

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