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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,64b29dfa2220a59f X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!bolzen.all.de!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Reserve_Capacity for Unbounded_String? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1185134043.892012.217560@n2g2000hse.googlegroups.com> <1185203238.701948.307410@m37g2000prh.googlegroups.com> <1185395844.104043.194340@o61g2000hsh.googlegroups.com> <46a7c85b$0$3827$9b4e6d93@newsspool4.arcor-online.net> <1185431043.649372.223760@r34g2000hsd.googlegroups.com> Date: Thu, 26 Jul 2007 10:09:08 +0200 Message-ID: <10fo5wx5wokvq$.1e0lhbpujtpma$.dlg@40tude.net> NNTP-Posting-Date: 26 Jul 2007 10:05:20 CEST NNTP-Posting-Host: ab7f073c.newsspool3.arcor-online.net X-Trace: DXC=FCU5;X_K9H2QbA1[CgMQ00McF=Q^Z^V384Fo<]lROoR1^YC2XCjHcb97ikg2RM5^@SS^oO? X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:1193 Date: 2007-07-26T10:05:20+02:00 List-Id: 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