From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Ada and Unicode Date: Tue, 20 Apr 2021 14:06:26 -0500 Organization: JSA Research & Innovation Message-ID: References: <607b5b20$0$27442$426a74cc@news.free.fr> <86mttuk5f0.fsf@stephe-leake.org> Injection-Date: Tue, 20 Apr 2021 19:06:27 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="12748"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:61869 List-Id: "Luke A. Guest" wrote in message news:s5jute$1s08$1@gioia.aioe.org... > > > On 19/04/2021 13:52, Dmitry A. Kazakov wrote: > > > It is practical solution. Ada type system cannot express differently > represented/constrained string/array/vector subtypes. Ignoring Latin-1 and > using String as if it were an array of octets is the best available > solution. > > > > 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! If they're incompatible, you need an automatic way to convert between representations, since these are all views of the same thing (an abstract string type). You really don't want 35 versions of Open each taking a different string type. It's the fact that Ada can't do this that makes Unbounded_Strings unusable (well, barely usable). Ada 202x fixes the literal problem at least, but we'd have to completely abandon Unbounded_Strings and use a different library design in order for for it to allow literals. And if you're going to do that, you might as well do something about UTF-8 as well -- but now you're going to need even more conversions. Yuck. I think the only true solution here would be based on a proper abstract Root_String type. But that wouldn't work in Ada, since it would be incompatible with all of the existing code out there. Probably would have to wait for a follow-on language. Randy.