comp.lang.ada
 help / color / mirror / Atom feed
From: David Rasmussen <pinkfloydhomer@yahoo.com>
Subject: Re: with and use
Date: Wed, 10 Jul 2002 15:45:13 +0200
Date: 2002-07-10T15:45:13+02:00	[thread overview]
Message-ID: <3D2C3A69.8070207@yahoo.com> (raw)
In-Reply-To: aghchh$oqb$1@s1.read.news.oleane.net

Jean-Pierre Rosen wrote:
 > "David Rasmussen" <pinkfloydhomer@yahoo.com> a �crit dans le message
 > news: 3D2C2FF9.4020300@yahoo.com...
 >
 >> First of all, what does this message from GNAT mean:
 >>
 >> "with" can only appear in context clause
 >>
 >
 > A context clause is a clause that appears *before* a compilation
 > unit. A with clause cannot appear *inside* anything else, so this
 > basically means that you have to move the with clause on top of the
 > unit.
 >

Thanks!

 >
 >> Secondly, where is with and use typically used, and what is the
 >> difference between them?
 >>
 >
 > A with clause means that a compilation unit needs the services from
 > another *compilation unit* (i.e. a package, subprogram or generic
 > which is separately compiled).
 >
 > A use clause factors out a *package*, i.e. you don't have to repeat
 > the package name in front of every element. Since a package can (but
 > needs not) be a compilation unit, there are cases where both clauses
 > can be applied, but they are really orthogonals.
 >

So with corresponds roughly to an #include of some header file that 
defines prototypes etc. for some other compilation unit in C++, and use 
corresponds roughly to "using namespace Whatever", assuming that the 
things included were in a seperate namespace?

"with" and only appear at the top of a unit. Where can "use" appear?

/David




  reply	other threads:[~2002-07-10 13:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-10 13:00 with and use David Rasmussen
2002-07-10 13:25 ` Jean-Pierre Rosen
2002-07-10 13:45   ` David Rasmussen [this message]
2002-07-10 14:24     ` Jean-Pierre Rosen
2002-07-10 19:17       ` Ted Dennison
2002-07-10 17:18     ` Jeffrey D. Cherry
  -- strict thread matches above, loose matches on Subject: below --
2002-07-10 17:20 Gautier direct_replies_not_read
replies disabled

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