From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FREEMAIL_REPLY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,c999596f866f316a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-10 06:45:14 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!news.tele.dk!not-for-mail Message-ID: <3D2C3A69.8070207@yahoo.com> Date: Wed, 10 Jul 2002 15:45:13 +0200 From: David Rasmussen User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020615 Debian/1.0.0-3 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: with and use References: <3D2C2FF9.4020300@yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Organization: TDC Internet NNTP-Posting-Host: 195.215.62.2 X-Trace: 1026308713 dtext.news.tele.dk 16813 195.215.62.2 X-Complaints-To: abuse@post.tele.dk Xref: archiver1.google.com comp.lang.ada:26984 Date: 2002-07-10T15:45:13+02:00 List-Id: Jean-Pierre Rosen wrote: > "David Rasmussen" 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