From: "John B. Matthews" <nospam@nospam.invalid>
Subject: Re: confusion with string initialization
Date: Mon, 19 Apr 2010 23:37:31 -0400
Date: 2010-04-19T23:37:31-04:00 [thread overview]
Message-ID: <nospam-CB6ED1.23373119042010@news.aioe.org> (raw)
In-Reply-To: 30c5b01f-8620-4aa7-8bd1-8e39e0fa5296@z21g2000pre.googlegroups.com
In article
<30c5b01f-8620-4aa7-8bd1-8e39e0fa5296@z21g2000pre.googlegroups.com>,
Adam Beneschan <adam@irvine.com> wrote:
> On Apr 19, 11:20 am, "John B. Matthews" <nos...@nospam.invalid> wrote:
> > In article <hqhod3$ti...@news.eternal-september.org>,
> > "J-P. Rosen" <ro...@adalog.fr> 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 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 "="). 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.
Thanks for responding, Adam. That's exactly what I was looking for. My
usual cohorts have sensible "use" policies, but one likes to be
prepared. :-)
--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
next prev parent reply other threads:[~2010-04-20 3:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-17 13:21 confusion with string initialization brett
2010-04-17 13:06 ` Georg Bauhaus
2010-04-17 17:42 `
2010-04-17 19:01 ` J-P. Rosen
2010-04-17 21:30 ` Jeffrey R. Carter
2010-04-18 2:13 ` brett
2010-04-18 13:36 ` Alex Mentis
2010-04-19 14:54 ` Colin Paul Gloster
2010-04-19 14:12 ` J-P. Rosen
2010-04-19 18:20 ` John B. Matthews
2010-04-19 23:18 ` Adam Beneschan
2010-04-20 3:37 ` John B. Matthews [this message]
2010-04-27 9:08 ` Jacob Sparre Andersen
2010-04-28 13:26 ` BrianG
2010-04-19 19:48 `
2010-04-19 20:05 ` Warren
2010-04-19 20:06 ` Georg Bauhaus
2010-04-21 1:12 ` brett
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox