comp.lang.ada
 help / color / mirror / Atom feed
From: gautier_niouzes@hotmail.com (Gautier)
Subject: Re: Safe "use" directive
Date: 9 Nov 2002 02:36:24 -0800
Date: 2002-11-09T10:36:24+00:00	[thread overview]
Message-ID: <17cd177c.0211090236.3861733a@posting.google.com> (raw)
In-Reply-To: 3dcba716$0$305$bed64819@news.gradwell.net

Victor Porton:

...
> This avoids the danger of initentedly "use"ing a subrountine from
> one package working on a type from an other package instead of
> assumed the-same-named subrountine from the second package.

Too complicated, I think. The solution is to "use" both packages,
the compiler must then detect ambiguities:

with Text_IO;                           use Text_IO;
with Dual_IO;                           use Dual_IO;

procedure Test_Use is
begin
  New_Line;
end Test_Use;

* ObjectAda:
test_use.adb: Error: line 6 col 3 LRM:8.6(31), Ambiguous call,
possible definitions of New_Line appear at line 92 of file
ada.text_io.spc, line 58 of file dual_io.ads.

* GNAT:
test_use.adb:6:03: ambiguous expression (cannot resolve "New_Line")
test_use.adb:6:03: possible interpretation at dual_io.ads:58
test_use.adb:6:03: possible interpretation at a-textio.ads:169
________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, address on the Web site!



  parent reply	other threads:[~2002-11-09 10:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-08 11:53 Safe "use" directive Victor Porton
2002-11-08 17:18 ` Peter Richtmyer
2002-11-09 10:36 ` Gautier [this message]
2002-11-11 14:44 ` Ted Dennison
  -- strict thread matches above, loose matches on Subject: below --
2002-11-12 22:03 Gautier direct_replies_not_read
2002-11-18  1:57 ` Richard Riehle
replies disabled

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