From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!cleanfeed2-b.proxad.net!nnrp2-1.free.fr!not-for-mail From: Thomas Newsgroups: comp.lang.ada Mail-Copies-To: nobody Subject: Re: Ada and Unicode References: <607b5b20$0$27442$426a74cc@news.free.fr> <86mttuk5f0.fsf@stephe-leake.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Date: Sun, 03 Apr 2022 19:24:11 +0200 Message-ID: Organization: Guest of ProXad - France NNTP-Posting-Date: 03 Apr 2022 19:24:12 CEST NNTP-Posting-Host: 91.175.52.121 X-Trace: 1649006652 news-2.free.fr 29474 91.175.52.121:16074 X-Complaints-To: abuse@proxad.net Xref: reader02.eternal-september.org comp.lang.ada:63688 List-Id: In article , "Dmitry A. Kazakov" wrote: > On 2021-04-19 15:15, Luke A. Guest wrote: > > On 19/04/2021 14:10, Dmitry A. Kazakov wrote: > > > >>> They're different types and should be incompatible, because, well, > >> they are. What does Ada have that allows for this that other languages > >> doesn't? Oh yeah! Types! > >> > >> They are subtypes, differently constrained, like Positive and Integer. > > > > No they're not. They're subtypes only and therefore compatible. The UTF > > string isn't constrained in any other ways. > > Of course it is. There could be string encodings that have no Unicode > counterparts and thus missing in UTF-8/16. 1 there is missing a validity function to tell weather a given UTF_8_String is valid or not, and a Dynamic_Predicate on the subtype UTF_8_String connected to the function. 2 more important, (when non-ASCII,) valid UTF_8_String *do not* represent the same thing as themselves converted to String. > > >> Operations are same values are differently constrained. It does not > >> make sense to consider ASCII 'a', Latin-1 'a', UTF-8 'a' different. It > >> is same glyph differently encoded. Encoding is a representation > >> aspect, ergo out of the interface! it works because 'a' is ASCII. if you try it with a non-ASCII character, all goes wrong. -- RAPID maintainer http://savannah.nongnu.org/projects/rapid/