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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Strange crash on custom iterator Date: Wed, 4 Jul 2018 12:01:10 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <70c11a71-3832-4f57-8127-f3f1c48a052f@googlegroups.com> <62e38ee4-f72f-4ed8-bef1-952040fb7f8d@googlegroups.com> <64d8b4a1-a92c-4b90-b95c-e821749de969@googlegroups.com> <887212304.552080112.848502.laguest-archeia.com@nntp.aioe.org> <87muvan83x.fsf@adaheads.home> <1449870001.552246132.581310.laguest-archeia.com@nntp.aioe.org> NNTP-Posting-Host: MyFhHs417jM9AgzRpXn7yg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.3 Xref: reader02.eternal-september.org comp.lang.ada:53569 Date: 2018-07-04T12:01:10+02:00 List-Id: On 2018-07-04 11:55, J-P. Rosen wrote: > Le 04/07/2018 à 09:53, Dmitry A. Kazakov a écrit : >> On 2018-07-04 09:33, J-P. Rosen wrote: >> Premature optimization, huh? And you still need UTF-8 string type >> even if you are going to convert it to something else. Back to the >> square one, how to design an UTF-8 string type? >> > Choosing a representation that allows a more efficient algorithm is > proper design, not premature optimization. But UTF-8 is actually more efficient in most cases than Wide_Wide_String. Random string indexing is practically never used. > And the point is that when you receive a string, you don't know before > looking at the BOM (or other recognition techniques) whether the octets > you received are pure Latin-1 or UTF_8 encoded. So you need to store it > in a plain String. That is not a string at all, it is a stream array or an array of octets. > We discussed that point, and the agreement was that making a different > type would force the user to many conversions that would bring nothing > but trouble, and make Ada once again look impractical out of excessive > purism. Exactly my point. Explicit conversion are necessary because Ada's type system is unable to model strings in a type-safe way. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de