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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.106.229 with SMTP id gx5mr21318152obb.31.1398296929133; Wed, 23 Apr 2014 16:48:49 -0700 (PDT) Path: border1.nntp.dca.giganews.com!nntp.giganews.com!l13no10266735iga.0!news-out.google.com!du2ni14996qab.0!nntp.google.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!fx32.iad.POSTED!not-for-mail From: Shark8 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:31.0) Gecko/20100101 Thunderbird/31.0a1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Your wish list for Ada 202X References: <7f1c01c5-3563-4b94-9831-152dbbf2ecdc@googlegroups.com> <9f156351-e3d0-4d86-b816-1d5e09ee69da@googlegroups.com> <4e3a0e68-1514-4255-9c76-ef8758991ded@googlegroups.com> <1398288591.4400.104.camel@pascal.home.net> In-Reply-To: Message-ID: X-Complaints-To: abuse@teranews.com NNTP-Posting-Date: Wed, 23 Apr 2014 23:48:48 UTC Organization: TeraNews.com Date: Wed, 23 Apr 2014 17:48:47 -0600 X-Received-Bytes: 2871 X-Received-Body-CRC: 3401756285 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Original-Bytes: 2890 Xref: number.nntp.dca.giganews.com comp.lang.ada:186053 Date: 2014-04-23T17:48:47-06:00 List-Id: On 23-Apr-14 16:00, J-P. Rosen wrote: > > Actually, the carefull separation between "with" and "use" has been > designed to allow opening visibility just when and where you need > access to the content. Putting "use" on top of the unit defeats the > very purpose of the "use" clause. I'm going to disagree, slightly; putting a use clause at the top of the unit can certainly be valid -- consider using a thick-binding hierarchy, to a library that you're using to implement functionality X -- since your writing to that binding it is perfectly valid to USE it. (And since you're writing specifically to that binding there's little sense in not doing it -- though, to be fair, you can make it so that the structure of your application is independent of the library via a "layered" approach... then using a different lib is simply writing to the application/binding interface you already have.) Another reason is uniformity -- if you have a unit that's going to be using a lot of the operations from different units you can use them all and keep things uniform: With Ada.Integer_IO, Ada.Text_IO, Some_Lib.Text_IO, Some_Lib.Types; Use Ada.Integer_IO, Ada.Text_IO, Some_Lib.Text_IO; -- Library-Level Put Procedure Put( Input : Some_Lib.Types.Some_Record ) si begin Put( "Integer-Field:" ); Put( Input.Integer_Field ); New_Line; Put( "Name:" ); Put( Input.Name ); New_Line; --... and so on. end Library_Level_Put; > "use" clauses are very helpful and make code a lot more readable, > provided they are restricted to the innermost context where they are > useful (and of course, you have an AdaControl rule to enforce that ;-) ). I fully agree that they are useful/helpful.