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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: buffer1.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!ecngs!feeder2.ecngs.de!81.171.88.16.MISMATCH!hq-usenetpeers!hq-usenetpeers.eweka.nl!xlned.com!feeder3.xlned.com!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Tue, 15 Jul 2014 09:36:17 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Position of "use" References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <53c4d9ec$0$6658$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 15 Jul 2014 09:36:12 CEST NNTP-Posting-Host: 018b9b99.newsspool3.arcor-online.net X-Trace: DXC=RF39YJ0CnG>^8FBo0_81f>McF=Q^Z^V384Fo<]lROoR18kFejV8QQfIKUEA2Z71i1ZOZGe4R= X-Complaints-To: usenet-abuse@arcor.de X-Received-Bytes: 3008 X-Received-Body-CRC: 2462704924 Xref: number.nntp.dca.giganews.com comp.lang.ada:187593 Date: 2014-07-15T09:36:12+02:00 List-Id: On 15.07.14 07:56, anon@att.net wrote: > The "With_Clause" > -- scope is defined in RM 10.1.2 (5), and does suggest that the > -- "With_Clause" for a multiple compilation files are global. 10.1.2 (5) refers to a declaration (such as a package declaration), and to this declaration's declarative region. 10.1.1 lists compilation_unit as either a library_item or a subunit. (For example, a package spec, or a separate procedure body.) 8.1, at which Adam Beneschan has hinted, expounds declarative_region, mentioned in 10.1.2. For any such declaration, as I understand it, a with_clause is in scope of the corresponding declarative_region, but nowhere else. So, for example, a with_clause above a package spec will be in scope of a package spec, its body, a separate procedure body (subunit) declared somewhere in the package, and children of the package. But, for example, another package (other than children of the first, or subunits) that happens to be declared in the same file establishes another declarative region. Any with_clause, then, that is atop any prior declarative region is not in scope of this package's declarative region. GNAT's gnatchop will confirm this when run on the two units below placed in the same one file. I do get a warning about redundant with clauses, when the compiler analyses the resulting unit associated with the name Foo. I do get two files, foo.adb and bar.adb. But gnatchop does not place a with_clause ("with Ada.Text_Io") in bar.adb. Correspondingly, any use_clause placed anywhere in the declarative region of Bar will not work. Nor will Ada.Text_Io.Put_Line name a procedure, as Ada.Text_IO will not have been with-ed there. with Ada.Text_Io; with Ada.Text_Io ; procedure Foo is begin Ada.Text_Io.Put_Line ("Foo"); end Foo; procedure Bar is begin Ada.Text_Io.Put_Line ("Bar"); end Bar;