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 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Problem with Unbounded Strings Date: Sat, 5 Dec 2015 13:19:32 +0100 Organization: cbb software GmbH Message-ID: <1siyyh4jy0qq0$.1jb3196h6zjwc$.dlg@40tude.net> References: <17lytwwdndg6u.1o21jn6ox2sd4$.dlg@40tude.net> <2c489db5-0d14-4a1e-9883-cf018c3a0b83@googlegroups.com> <19i08yxoly6r5.lk9snum67ier.dlg@40tude.net> <3t2zcznh7x3c$.1gg5z5cxi63r3.dlg@40tude.net> <31641315-84b9-427a-bc53-9d246c38acfb@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: Sfz0eNwKWh4Uq03iti+GMw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:28656 Date: 2015-12-05T13:19:32+01:00 List-Id: On Sat, 5 Dec 2015 02:22:36 -0800 (PST), Laurent wrote: >>No, the strategy is to pass lines or other parts of the >message further >>instead of accumulating it in the memory. Instead of this >"hamster" design >>I would do something like: > >> Buffer : String (1..Size); -- Input is accumulated here > > Eh isn't that a contradiction? There is still a buffer For just one line. You are trying to merge an unlimited number of. This is a waste of resources and potential problem with latencies. For example, modern poorly designed text editors load whole file first. What happens when the file is large? The editor gets blocked. > and it is even combined with those evil accesses!? Access is needed for the mix-in pattern. It is a language design bug that the discriminant must be an access even if the target is a by-reference type. Instead of mix-in you can pass stream to each call explicitly, which is not better. Or you can pack the access type into a handle type. BTW, Unbounded_String is just that, a handle type wrapping some access to the dynamically allocated body. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de