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 22:55:24 +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: 3CrKQyqWAJZHy6zYVP/kUg.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:53620 Date: 2018-07-04T22:55:24+02:00 List-Id: On 2018-07-04 22:40, G. B. wrote: > Dmitry A. Kazakov wrote: >> On 2018-07-04 21:02, G. B. wrote: >>> Dmitry A. Kazakov wrote: >>> >>>> Back to the square >>>> one, how to design an UTF-8 string type? >>> >>> Never. >>> >>> What is the proper representation of 3? >> >> What is 3 here? > > It names a value of some type. Which type? You name the type, I name the representation. >>> Which role does a UTF play, other than during I/O operations? >> >> UTF-8 is a preferable encoding for most text processing purposes. > > Like finding the number of characters that some Ada string has? This operation is practically never required in text processing. The strength (and a design goal) of UTF-8 is that almost all useful operations defined in terms of characters are directly mapped into operations defined on octets. The rest may have whatever complexity, nobody cares. >> Should string types never be fixed, a quick and dirty solution would be >> throwing wide string types away > > Maybe. Sort of works, in Java. > >> and declaring String with all its >> bastards (Unbounded_String etc) UTF-8. > > I’d not want encoding here. There is always some. UTF-8 is a choice with the best balance of advantages vs disadvantage. >>> Practically, that’s properly typed proper procedures, no? >> >> You lost me here again. > > A string to be output somewhere may need an encoding. (‘H’, ‘e’, ‘l’, ‘l’, > ‘o’) does not need one to be useful, but output is performed by a value of > type File * String * Encoding -> Void: a properly typed procedure. It is almost never decomposed this way. Encoding is a part of string type representation. File I/O is usually untyped or weakly typed. At best the encoding is a parameter of file open. Ada text I/O packages are designed to deal with a single type of strings with encoding taken from the string type. But I still have no idea what you want to say by that. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de