comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Reserve_Capacity for Unbounded_String?
Date: Thu, 26 Jul 2007 10:09:08 +0200
Date: 2007-07-26T10:05:20+02:00	[thread overview]
Message-ID: <10fo5wx5wokvq$.1e0lhbpujtpma$.dlg@40tude.net> (raw)
In-Reply-To: 1185431043.649372.223760@r34g2000hsd.googlegroups.com

On Wed, 25 Jul 2007 23:24:03 -0700, Maciej Sobczak wrote:

> This is what I'm actually doing when typing this post. I append
> characters to what is already there (let's forget correcting typos -
> automated procedures don't have to do this).

You append characters to words, words to sentences and sentences to
paragraphs. String is not the best possible representation for a text.

> It is the language that
> should provide the implementation that is best fitted to how
> programmers express their algorithms. Why do you think Java added
> StringBuilder to its library? Because the immutable String didn't
> quite cut it.

Maybe, but Unbounded_String is not the best way to express algorithms. As
for me I avoid using Unbounded_String. I don't like the design of.

This does not mean that other containers should not have
"accumulation"/"stream" mode. For them I tend to specify the initial size
and the multiplier factor.

Perhaps, one could introduce something like that for Unbounded_String:

   X : Unbounded_String := ...;
   for X'Initial_Size use 1024*8;  -- 1K at least
   for X'Increment_Factor use 1.5; -- Multiply by 1.5 upon expanding


-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2007-07-26  8:09 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-22 19:54 Reserve_Capacity for Unbounded_String? Maciej Sobczak
2007-07-22 21:32 ` Robert A Duff
2007-07-23 19:29   ` Maciej Sobczak
2007-07-23 20:30     ` Robert A Duff
2007-07-23  4:28 ` Jeffrey R. Carter
2007-07-23 15:07 ` Adam Beneschan
2007-07-24  1:01   ` Randy Brukardt
2007-07-24  7:57     ` Pascal Obry
2007-07-24 18:58       ` Randy Brukardt
2007-07-24 23:50         ` Robert A Duff
2007-07-25  0:00           ` Randy Brukardt
2007-07-24 23:54         ` Pascal Obry
2007-07-25  0:52           ` Randy Brukardt
2007-07-25  1:28           ` Randy Brukardt
2007-07-25  7:48             ` Pascal Obry
2007-07-25  9:55               ` Georg Bauhaus
2007-07-25 10:02                 ` Georg Bauhaus
2007-07-25 18:58               ` Randy Brukardt
2007-07-25  8:50             ` Martin Krischik
2007-07-25  9:26               ` AW: " Grein, Christoph (Fa. ESG)
2007-07-25 15:32                 ` Martin Krischik
2007-07-25 15:39                 ` Martin Krischik
2007-07-24 23:41     ` Robert A Duff
2007-07-25  0:16       ` Randy Brukardt
2007-07-25  2:25         ` Robert A Duff
2007-07-25  6:07           ` Simon Wright
2007-07-25 19:08           ` Randy Brukardt
2007-07-25 20:37             ` Maciej Sobczak
2007-07-25 22:06               ` Georg Bauhaus
2007-07-26  6:24                 ` Maciej Sobczak
2007-07-26  8:09                   ` Dmitry A. Kazakov [this message]
2007-07-26  8:20                     ` Pascal Obry
2007-07-26  9:59                       ` Dmitry A. Kazakov
2007-07-26  8:35                   ` Georg Bauhaus
2007-07-26 22:11               ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox