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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ab3fadb7cac7363c X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!fdn.fr!freenix!feeder.news.orange.fr!not-for-mail Message-ID: <4DEE60E9.2020408@obry.net> Date: Tue, 07 Jun 2011 19:33:29 +0200 From: Pascal Obry Organization: Home - http://www.obry.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr-FR; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.5.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada To: milouz Subject: Re: using `use' : what is the best practice ? References: <57e75a35-058c-4172-9a3d-e11e7c5f7697@l2g2000prg.googlegroups.com> In-Reply-To: <57e75a35-058c-4172-9a3d-e11e7c5f7697@l2g2000prg.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Date: 07 Jun 2011 19:33:29 CEST NNTP-Posting-Host: 90.2.73.196 X-Trace: 1307468009 reader.news.orange.fr 30755 90.2.73.196:4966 X-Complaints-To: abuse@orange.fr Xref: g2news2.google.com comp.lang.ada:20654 Date: 2011-06-07T19:33:29+02:00 List-Id: Le 07/06/2011 17:32, milouz a �crit : > But always avoiding 'use' give some rather obfuscated code, especially > when using some specific arithmetic operator. For example, playing > with Address arithmetic without 'use' : I don't like use so when *I* design a package I prefer to take a convention where use is not necessary. But when you want to use an already built API you must often use it the way it has been designed to be used. Take for example Unbounded_String, nobody will avoid using use in this case... Look at this code: with Ada.Strings.Unbounded; procedure Whatever is S : Ada.Strings.Unbounded.Unbounded_String; begin Ada.Strings.Unbounded.Append (S, "toto"); end Whatever; Far better with: with Ada.Strings.Unbounded; procedure Whatever is use Ada.Strings.Unbounded; S : Unbounded_String; begin Append (S, "toto"); end Whatever; Because Ada.Strings.Unbounded (and all Ada runtime packages) has been designed to be used with a use clause. Now I do prefer: package Circle is type Object is... And use it as: with Circle; O : Circle.Object; To package Circle is type Circle_Type is... And use it as: with Circle; use Circle; O : Circle_Type; But all styles are around... Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.net - http://v2p.fr.eu.org --| "The best way to travel is by means of imagination" --| --| gpg --keyserver keys.gnupg.net --recv-key F949BD3B