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!cleanfeed3-b.proxad.net!nnrp1-2.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: 8bit User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Date: Sun, 03 Apr 2022 20:04:36 +0200 Message-ID: Organization: Guest of ProXad - France NNTP-Posting-Date: 03 Apr 2022 20:04:37 CEST NNTP-Posting-Host: 91.175.52.121 X-Trace: 1649009077 news-2.free.fr 13432 91.175.52.121:14286 X-Complaints-To: abuse@proxad.net Xref: reader02.eternal-september.org comp.lang.ada:63689 List-Id: In article , "J-P. Rosen" wrote: > Le 19/04/2021 à 15:00, Luke A. Guest a écrit : > > 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 not so different. For example, you may read the first line of a > file in a string, then discover that it starts with a BOM, and thus > decide it is UTF-8. could you give me an example of sth that you can do yet, and you could not do if UTF_8_String was private, please? (to discover that it starts with a BOM, you must look at it.) > > BTW, the very first version of this AI had different types, but the ARG > felt that it would just complicate the interface for the sake of abusive > "purity". could you explain "abusive purity" please? i guess it is because of ASCII. i guess a lot of developpers use only ASCII in a lot of situation, and they would find annoying to need Ada.Strings.UTF_Encoding.Strings every time. but I think a simple explicit conversion is acceptable, for a not fully compatible type which requires some attention. the best would be to be required to use ASCII_String as intermediate, but i don't know how it could be designed at language level: UTF_8_Var := UTF_8_String (ASCII_String (Latin_1_Var)); Latin_1_Var:= String (ASCII_String (UTF_8_Var)); and this would be forbidden : UTF_8_Var := UTF_8_String (Latin_1_Var); this would ensures to raise Constraint_Error when there are somme non-ASCII characters. -- RAPID maintainer http://savannah.nongnu.org/projects/rapid/