comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adambeneschan@gmail.com>
Subject: Re: Position of "use"
Date: Mon, 7 Jul 2014 09:45:09 -0700 (PDT)
Date: 2014-07-07T09:45:09-07:00	[thread overview]
Message-ID: <e2ad373b-7c07-489e-8211-7d007966b3ee@googlegroups.com> (raw)
In-Reply-To: <lp88ht$6n5$1@dont-email.me>

On Saturday, July 5, 2014 12:12:59 AM UTC-7, J-P. Rosen wrote:
> Le 05/07/2014 08:43, Victor Porton a �crit :
> 
> > What is the difference between
> 
> > with X; use X;
> > package Y is
> > end Y;
> 
> > and
> 
> > with X;
> > package Y is
> >    use X;
> > end Y;

> > ?
> 
> A use clause (as well as any declaration) is usable from where it
> appears up to the associated "end".
> 
> 
> In the first case, it will allow short names for other with/use clauses,
> while in the second case it will be effective only inside the package.

Not true.  This is illegal:

    with Ada;
    use Ada;
    with Strings.Unbounded;
    package X is ...

You can't use this as a substitute for "with Ada.Strings.Unbounded".

The visibility rules for context clauses are separate from visibility rules in other cases.  At the moment, I am not sure there is any difference at all between Victor's two examples; I'll have to study the rules carefully to make sure.  It's possible that there is a difference if there is a child package (package X.Child is ...), or if there is a pragma in the context clause.  I'll try to look at it later.

                             -- Adam

  reply	other threads:[~2014-07-07 16:45 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-05  6:43 Position of "use" Victor Porton
2014-07-05  7:12 ` J-P. Rosen
2014-07-07 16:45   ` Adam Beneschan [this message]
2014-07-07 17:08     ` Pascal Obry
2014-07-07 17:40       ` Peter Chapin
2014-07-07 19:17       ` Adam Beneschan
2014-07-08  5:26     ` J-P. Rosen
2014-07-08 15:32       ` Adam Beneschan
2014-07-08 19:30 ` Adam Beneschan
2014-07-08 22:39   ` Victor Porton
2014-07-09 10:36 ` anon
2014-07-09 15:14   ` Adam Beneschan
2014-07-10  1:27     ` anon
2014-07-10  9:50       ` AdaMagica
2014-07-10 13:10         ` J-P. Rosen
2014-07-10 15:57           ` Adam Beneschan
2014-07-10 17:47             ` Tero Koskinen
2014-07-10 19:15           ` Jeffrey Carter
2014-07-15  5:56         ` anon
2014-07-15  7:36           ` Georg Bauhaus
2014-07-15 17:01             ` Simon Wright
2014-07-15 17:23               ` Jeffrey Carter
2014-07-15 19:44                 ` Simon Wright
2014-07-15 17:47               ` G.B.
2014-07-15 17:51               ` Adam Beneschan
2014-07-15 20:04                 ` Simon Wright
2014-07-16  7:19                 ` anon
2014-07-10 15:54       ` Adam Beneschan
replies disabled

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