comp.lang.ada
 help / color / mirror / Atom feed
From: robert_dewar@my-dejanews.com
Subject: Re: Why both "with" and "use"?
Date: 1999/02/18
Date: 1999-02-18T00:00:00+00:00	[thread overview]
Message-ID: <7ai5br$6g3$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 7ah3te$g6p$1@platane.wanadoo.fr

In article <7ah3te$g6p$1@platane.wanadoo.fr>,
  "Jean-Pierre Rosen" <rosen.adalog@wanadoo.fr> wrote:
> Of course, this is an abuse and common sense applies. My
> example was rather:

> exception
>    when Occur : others =>
>       declare
>           use Ada.Exceptions;
>       begin
>            Put_Line ("Oops" & Exception_Name (Occur));
>            Raise_Exception (My_Exception'Identity,
>                  Message => Exception_Message (Occur));
>       end;
>
> Here, I wouldn't like a use clause applying to the whole
> subprogram when I really need it only in the exception
> part.

I actually am just as happy to take this as an example of
unnecessary obfuscation. Here we have a package whose names
have been designed to be conveniently used with a USE
clause. THere is really no reason to write
Ada.Exceptions.Exception_Message, instead of just
Exception_Message.

Now the normal approach of simply adding the use clause
to the context clause puts the use clause out of the way
and takes only three tokens.

JPR's usage above takes 8 tokens, even assuming it is only
used once in a unit (8*N if it is used N times), and worse,
inteferes with the clarity of the code by introducing
extraneous junk which serves no real purpose at this point
in the code.


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  reply	other threads:[~1999-02-18  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 ` Corey Minyard
1999-02-13  0:00   ` mike
1999-02-13  0:00   ` Matthew Heaney
1999-02-13  0:00     ` bill
1999-02-14  0:00       ` dewar
1999-02-14  0:00       ` dewar
1999-02-14  0:00       ` Matthew Heaney
1999-02-13  0:00     ` Tom Moran
1999-02-14  0:00       ` Matthew Heaney
1999-02-16  0:00     ` Samuel Mize
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             ` 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
1999-02-19  0:00             ` dennison
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                   ` Tom Moran
1999-02-19  0:00                     ` Mike Silva
1999-02-22  0:00                       ` Brian Hanson
1999-02-19  0:00                   ` robert_dewar
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 [this message]
1999-02-19  0:00               ` Jean-Pierre Rosen
1999-02-17  0:00       ` Matthew Heaney
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       ` Jean-Pierre Rosen
1999-02-13  0:00 ` Pat Rogers
1999-02-13  0:00   ` bill
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-13  0:00     ` Matthew Heaney
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-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