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,c58a5b8372dc24a0 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news4.google.com!feeder.news-service.com!news.k-dsl.de!aioe.org!not-for-mail From: "John B. Matthews" Newsgroups: comp.lang.ada Subject: Re: confusion with string initialization Date: Mon, 19 Apr 2010 14:20:15 -0400 Organization: The Wasteland Message-ID: References: NNTP-Posting-Host: LQJtZWzu+iKlBROuDg+IUg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Xref: g2news2.google.com comp.lang.ada:11042 Date: 2010-04-19T14:20:15-04:00 List-Id: In article , "J-P. Rosen" wrote: > Colin Paul Gloster a écrit : > > > Why did you consider a book which makes which packages things are > > in unclear by mutiliating programs by means of the USE keyword to > > be excellent? > > Because it makes lisibility a lot better by drawing attention of the > reader on what actually the thing does, and getting rid of useless > information that you can find easily by clicking on the identifier > and selecting "go to declaration". > > (Ok, Ok, I'm a bit provocative here, but I'm tired of seeing people > jumping on beginners and insisting on a notation that can drive them > away of the language screaming). Preferring not to overuse "use", I recall becoming an instant fan of "use type" when it was introduced in Ada '95. Is there a way to make Ada.Strings.Fixed."*" visible without the use clause? with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Strings.Bounded; with Ada.Strings.Unbounded; with Ada.Text_IO; procedure UseType is package String20 is new Ada.Strings.Bounded.Generic_Bounded_Length(20); use type String20.Bounded_String; package StringN renames Ada.Strings.Unbounded; use type StringN.Unbounded_String; SB : constant String20.Bounded_String := 20 * '*'; SN : constant StringN.Unbounded_String := 20 * '*'; S1 : constant String := Ada.Strings.Fixed."*"(20, '*'); S2 : constant String := 20 * '*'; begin Ada.Text_IO.Put_Line(String20.To_String(SB)); Ada.Text_IO.Put_Line(StringN.To_String(SN)); Ada.Text_IO.Put_Line(S1); Ada.Text_IO.Put_Line(S2); end UseType; -- John B. Matthews trashgod at gmail dot com