comp.lang.ada
 help / color / mirror / Atom feed
From: je@bton.ac.uk (John English)
Subject: Re: on OO differnces between Ada95 and C++
Date: 1996/02/26
Date: 1996-02-26T00:00:00+00:00	[thread overview]
Message-ID: <DnDuA4.8GC@bton.ac.uk> (raw)
In-Reply-To: 4gh204$l7n@qualcomm.com

Nasser Abbasi (nabbasi@qualcomm.com) wrote:
: In article <Dn4J2F.uI@bton.ac.uk>, je@bton.ac.uk (John English) says:
: >If the spec of Saving_Account has "with Account" at the beginning,
: >"with Saving_Account" will imply "with Account". 

: I do not think this is true. That is the main reason I asked the 
: question in the first place. (I did not like having to "with" 
: a package that was allready with'ed by a package I am "withing" ).

Hmm.  I've been having another look at the visibility rules in the LRM and,
as usual, they've made my head go round and round :-)

Certainly GNAT allows you to reference Account.X if you have "with
Saving_Account" (but I'm all too aware that GNAT /= Ada95 :-), although
the same is not true for "use" clauses ("use Saving_Account" does not
imply "use Account").  Remember that I'm talking about *with clauses in
package specifications* and not use clauses *or* package bodies (in case
there is any confusion about this).

: If what you say was the case, then types defined in package "A"
: will be seen by clients to a package "B" where "B" has with'ed A. But
: it is not so. Clients of "B" must also 'with' "A" to see types defined
: in "A" even though "B: has allready  with'ed "A".

If you're right this would be a real pain.  Clients of a package would have
to know (recursively) what other packages the spec(s) reference; if the
spec for X "withs" a package Y so it can use type Y.T as a procedure
parameter then you wouldn't be able to use X without Y (i.e. "with X"
on its own would be useless; you'd have to have "with X, Y" and probably
other things as well if Y has any "with" clauses in its specification.

This is such a horrible concept that I'm inclined to believe GNAT, but
if anyone who can understand all the subleties of the visibility rules
can give us all a definitive explanation in words of sufficiently few
syllables that Bears of Very Little Brain like me can understand, I for
one would be profoundly grateful.

-- 
----------------------------------------------------------------------------
John English <je@brighton.ac.uk>, Dept. of Computing, University of Brighton
  "Disks are divided into sex and tractors..."
----------------------------------------------------------------------------




  reply	other threads:[~1996-02-26  0:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-02-20  0:00 on OO differnces between Ada95 and C++ Nasser Abbasi
1996-02-20  0:00 ` Robert I. Eachus
1996-02-20  0:00 ` Norman H. Cohen
1996-02-21  0:00   ` Mark A Biggar
1996-02-22  0:00     ` Norman H. Cohen
1996-02-27  0:00   ` Adam Morris
1996-02-20  0:00 ` Jerome Desquilbet
1996-02-21  0:00   ` Robert Dewar
1996-02-22  0:00     ` Jerome Desquilbet
1996-02-24  0:00       ` Robert Dewar
1996-02-22  0:00   ` Pete Becker
1996-02-23  0:00     ` Jerome Desquilbet
1996-02-26  0:00     ` Darren C Davenport
1996-02-26  0:00       ` Pete Becker
1996-02-27  0:00         ` Nigel Perry
1996-02-21  0:00 ` Jon S Anthony
1996-02-21  0:00 ` John English
1996-02-22  0:00   ` Gene Ouye
1996-02-26  0:00     ` John English
1996-02-22  0:00   ` Nasser Abbasi
1996-02-26  0:00     ` John English [this message]
1996-02-27  0:00       ` Dale Stanbrough
1996-02-21  0:00 ` Darren C Davenport
  -- strict thread matches above, loose matches on Subject: below --
1996-02-21  0:00 Christian Jaensch, FRG
1996-02-26  0:00 Simon Johnston
replies disabled

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