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,ASCII Path: g2news1.google.com!postnews.google.com!z21g2000pre.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: confusion with string initialization Date: Mon, 19 Apr 2010 16:18:48 -0700 (PDT) Organization: http://groups.google.com Message-ID: <30c5b01f-8620-4aa7-8bd1-8e39e0fa5296@z21g2000pre.googlegroups.com> References: NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1271719129 31852 127.0.0.1 (19 Apr 2010 23:18:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 19 Apr 2010 23:18:49 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z21g2000pre.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:10080 Date: 2010-04-19T16:18:48-07:00 List-Id: On Apr 19, 11:20=A0am, "John B. Matthews" wrote: > In article , > =A0"J-P. Rosen" wrote: > > > Colin Paul Gloster a =E9crit : > > > > 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 a renaming declaration. Before Ada 95 came out, I often included a nested package named OPERATORS in packages that I wrote, in order to facilitate making operators visible (often just "=3D"). This package would contain renaming declarations for the operators I wanted to make visible. Then, instead of having to USE the whole package, I could say "use Pkg.OPERATORS" to make just the desired names visible. That would still work (and the package doesn't have to be nested). You can write your own package with Ada.Strings.Fixed; package Fixed_Operators is function "*" (Left : in Natural; Right : in Character) return String renames Ada.Strings.Fixed."*"; function "*" (Left : in Natural; Right : in String) return String renames Ada.Strings.Fixed."*"; end Fixed_Operators; and now "use Fixed_Operators;" will give you what you're looking for. (Caveat: I have not tested the above code.) Technically, I guess this doesn't answer your question about how to make the operators visible "without the use clause" [on a package], but it should be acceptable since it only makes visible certain specific things that you *want* to make visible, without making anything else visible that you don't want visible. -- Adam