comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Reserve_Capacity for Unbounded_String?
Date: Wed, 25 Jul 2007 23:24:03 -0700
Date: 2007-07-25T23:24:03-07:00	[thread overview]
Message-ID: <1185431043.649372.223760@r34g2000hsd.googlegroups.com> (raw)
In-Reply-To: <46a7c85b$0$3827$9b4e6d93@newsspool4.arcor-online.net>

On 26 Lip, 00:06, Georg Bauhaus <bauhaus.rm.t...@maps.futureapps.de>
wrote:

> > Building a string by appending small chunks to the end seems to be a
> > common practice. Optimizing the library for this case is a wise
> > implementation strategy.
>
> Is there some material on this? I'm wondering whether concatenating
> strings is more common in languages where strings are lists, or at
> least not plain arrays.

Why should that matter? Do you think that the implementation details
like this one can influence the way people *think* about strings in
their programs?

We read text from beginning to the end, acquiring information. It
seems obvious that, conversely, adding information to the string is
best achieved by adding more characters to the end, at least when
human-readable content is involved.

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).

Coming back to your question about different languages - it is not the
programmer who should adapt his way of building the strings according
to how the string is implemented internally in a given language (note
that many languages don't even specify it). 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.

--
Maciej Sobczak
http://www.msobczak.com/




  reply	other threads:[~2007-07-26  6:24 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 [this message]
2007-07-26  8:09                   ` Dmitry A. Kazakov
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