comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Why both "with" and "use"?
Date: 1999/02/23
Date: 1999-02-23T00:00:00+00:00	[thread overview]
Message-ID: <EACHUS.99Feb23172432@spectre.mitre.org> (raw)
In-Reply-To: 7akgvr$82k$1@nnrp1.dejanews.com

In article <7akgvr$82k$1@nnrp1.dejanews.com> robert_dewar@my-dejanews.com writes:

 > Well yes, especially easy, since Robert Eachus and I have
 > discussed this particular case many times (Robert, you
 > should really have let people who have NOT thought about
 > this before think a little longer, too bad you jumped in,
 > not really fair :-)

  If you hadn't posted on a Thursday, I would have waited longer.  But
our church was moving into a new building this weekend, so I didn't
expect to have time to log in from home.  (Or for that matter from the
church.  The phones lines weren't moved until late yesterday, so I
could do most of the work of setting up the computers, but not check
net access.)

 > Anyway, that should be instructive, most people find this
 > a surprise when they first encounter it.

  The classic, "It's not a bug it is a feature!"  Once you understand
it, you understand why any alternative would be worse, and it is one
of those language features you try to avoid the dark corners of.
Another is that overloading subprograms is a wonderful feature, as is
overriding.  But hiding a subprogram, or worse yet creating a
subprogram that can't be called is bad...  What's wrong with this
picture?

  with Ada.Text_IO;
  procedure Puzzle is
     procedure My_Put(S: String; N: Integer := 1) is 
     begin 
       Ada.Text_IO.New_Line(Ada.Text_IO.Count(N));
       Ada.Text_IO.Put(S);
     end My_Put;
     procedure My_Put(S: String) is 
     begin Ada.Text_IO.Put(S); end My_Put;
  begin
     My_Put("Hello World!");
  end Puzzle;

  Once you see why this won't compile, you think that it is no big
deal.  But it is!  If during maintenance a parameter with a default is
added to an outer declaration, it can cause working code not to
compile.  The best solution is to always avoid hiding in Ada--it
doesn't help much, and can be a later maintenance problem.
--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




  reply	other threads:[~1999-02-23  0:00 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-13  0:00 Why both "with" and "use"? Mike Silva
1999-02-13  0:00 ` Pat Rogers
1999-02-13  0:00   ` bill
1999-02-13  0:00     ` Matthew Heaney
1999-02-13  0:00     ` Pat Rogers
1999-02-13  0:00       ` Matthew Heaney
1999-02-13  0:00         ` bill
1999-02-14  0:00         ` Pat Rogers
1999-02-14  0:00           ` Bob Collins
1999-02-14  0:00             ` Pat Rogers
1999-02-16  0:00         ` Samuel Mize
1999-02-15  0:00     ` Jean-Pierre Rosen
1999-02-15  0:00       ` Ed Falis
1999-02-16  0:00         ` Jean-Pierre Rosen
1999-02-13  0:00 ` Corey Minyard
1999-02-13  0:00   ` Matthew Heaney
1999-02-13  0:00     ` Tom Moran
1999-02-14  0:00       ` Matthew Heaney
1999-02-13  0:00     ` bill
1999-02-14  0:00       ` Matthew Heaney
1999-02-14  0:00       ` dewar
1999-02-14  0:00       ` dewar
1999-02-16  0:00     ` Samuel Mize
1999-02-17  0:00       ` Jean-Pierre Rosen
1999-02-17  0:00       ` dennison
1999-02-17  0:00         ` Nick Roberts
1999-02-17  0:00         ` Samuel Mize
1999-02-17  0:00       ` Matthew Heaney
1999-02-17  0:00       ` Jean-Pierre Rosen
1999-02-18  0:00         ` dennison
1999-02-18  0:00           ` robert_dewar
1999-02-19  0:00             ` dennison
1999-02-19  0:00             ` Robert I. Eachus
1999-02-19  0:00               ` Brian Hanson
1999-02-19  0:00                 ` robert_dewar
1999-02-19  0:00               ` robert_dewar
1999-02-23  0:00                 ` Robert I. Eachus [this message]
1999-02-19  0:00             ` bourguet
1999-02-19  0:00               ` robert_dewar
1999-02-19  0:00           ` Matthew Heaney
1999-02-19  0:00             ` dennison
1999-02-19  0:00               ` robert_dewar
1999-02-19  0:00                 ` Ada multiple string personalities. why so many? mike
1999-02-19  0:00                   ` robert_dewar
1999-02-19  0:00                   ` Tom Moran
1999-02-19  0:00                     ` Mike Silva
1999-02-22  0:00                       ` Brian Hanson
1999-02-19  0:00                 ` Why both "with" and "use"? dennison
1999-02-19  0:00                   ` robert_dewar
1999-02-18  0:00         ` robert_dewar
1999-02-18  0:00           ` Jean-Pierre Rosen
1999-02-18  0:00             ` robert_dewar
1999-02-19  0:00               ` Jean-Pierre Rosen
1999-02-13  0:00   ` mike
1999-02-15  0:00 ` Jean-Pierre Rosen
replies disabled

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