From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6cb2525ffbfe23ce X-Google-Attributes: gid103376,public From: robert_dewar@my-dejanews.com Subject: Re: Why both "with" and "use"? Date: 1999/02/18 Message-ID: <7ai5br$6g3$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 445842935 References: <36C5B28C.F32C43A4@jps.net> <7acj53$1vu@news3.newsguy.com> <7af68r$52o$1@platane.wanadoo.fr> <7afue4$8ed$1@nnrp1.dejanews.com> <7ah3te$g6p$1@platane.wanadoo.fr> X-Http-Proxy: 1.0 x7.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Thu Feb 18 22:48:30 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-02-18T00:00:00+00:00 List-Id: In article <7ah3te$g6p$1@platane.wanadoo.fr>, "Jean-Pierre Rosen" 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