From: "John B. Matthews" <nospam@nospam.invalid>
Subject: Re: confusion with string initialization
Date: Mon, 19 Apr 2010 14:20:15 -0400
Date: 2010-04-19T14:20:15-04:00 [thread overview]
Message-ID: <nospam-2E27BC.14201519042010@news.aioe.org> (raw)
In-Reply-To: hqhod3$tit$1@news.eternal-september.org
In article <hqhod3$tit$1@news.eternal-september.org>,
"J-P. Rosen" <rosen@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 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
<http://sites.google.com/site/drjohnbmatthews>
next prev parent reply other threads:[~2010-04-19 18:20 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 [this message]
2010-04-19 23:18 ` Adam Beneschan
2010-04-20 3:37 ` John B. Matthews
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