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!news.eternal-september.org!news.eternal-september.org!mx05.eternal-september.org!feeder.eternal-september.org!newsfeed.fsmpi.rwth-aachen.de!news-1.dfn.de!news.dfn.de!news.uni-weimar.de!medsec1.medien.uni-weimar.de!lucks From: Stefan.Lucks@uni-weimar.de Newsgroups: comp.lang.ada Subject: Re: Is this expected behavior or not Date: Fri, 5 Apr 2013 14:45:55 +0200 Organization: Bauhaus-Universitaet Weimar Message-ID: References: <2qwq2cdeuvhu$.qtnb8zyhuob9$.dlg@40tude.net> <1u72u7h5j4jg3$.wlxmaltyzqik.dlg@40tude.net> <1gnmajx2fdjju.1bo28xwmzt1nr.dlg@40tude.net> <3gv2jwc95otm.pl2aahsh9ox8.dlg@40tude.net> <1gkxiwepaxvtt$.u3ly33rbwthf.dlg@40tude.net> <1fmcdkj58brky.bjedt0pr39cd$.dlg@40tude.net> <1bj564vat3q1j$.1s4d00rlzx4ux$.dlg@40tude.net> NNTP-Posting-Host: medsec1.medien.uni-weimar.de Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323329-1947109751-1365165956=:30208" X-Trace: tigger.scc.uni-weimar.de 1365166026 15362 141.54.178.228 (5 Apr 2013 12:47:06 GMT) X-Complaints-To: news@tigger.scc.uni-weimar.de NNTP-Posting-Date: Fri, 5 Apr 2013 12:47:06 +0000 (UTC) X-X-Sender: lucks@debian In-Reply-To: <1bj564vat3q1j$.1s4d00rlzx4ux$.dlg@40tude.net> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) Xref: news.eternal-september.org comp.lang.ada:14868 Date: 2013-04-05T14:45:55+02:00 List-Id: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1947109751-1365165956=:30208 Content-Type: TEXT/PLAIN; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Fri, 5 Apr 2013, Dmitry A. Kazakov wrote: >>> How is it an error to compare String and Wide_String? >> >> The same way it is an error to compare a float and an integer. > > It is not same. R and Z are different mathematical constructs. Sure! This is different from string types, where the distinction between=20 String, Wide_String, Wide_Wide_String, and whatever comes next has=20 historical reasons. It makes mixing narrow, Wide_ and Wide_Wide_ Strings=20 worse than mixing reals and integers. > Unicode strings, all of them, are semantically exactly same except for=20 > encoding [representation] and constraints put on the code point set. N is a subset of Z is a subset of Q is a subset of R. Furthermore, each "X is a subset of Y" relationship implies that any=20 operation possible in X is also possible in Y, including comparisons. How are generalised strings simpler than generalised numbers? > Mixed operations are a must for all algebraic types and all string types. Well, Ada does make a clear distinction between Universal_Integer and=20 Universal_Real. So why should it work for String types? > Ada 83 had it mixed from the start, e.g. Universal_Integer vs. Integer. Ada (all Adas from 83 to 2012) had two *different* algebraic root types. In any cases, there are good reasons why a program has sometimes to mix real and natural numbers. But what reasons would you have to actually mix= =20 narrow, Wide_ and Wide_Wide_ Strings? That is bad program design, anyway! It is error-prone low-level programming, quite similar to the C-style of=20 using memory addresses and pointer arithmetic. If you *have* to do it,=20 perhaps because you have to support some legacy interfaces, with different= =20 string types, you better hide the input/output stuff in some low-level=20 packages, and use a single kind of string in your application logic=20 (perhaps Wide_Wide_String, if the memory isn't too small). Of course, a single common root type for String, Bounded_String and=20 Unbounded_String would come handy -- similarly another root type for the=20 Wide_ and yet another for the Wide_Wide_ family. But note that not even=20 Universal_Integer does provide such a root type! The Standard(-Library)=20 did not even define any Bounded_Integer or Unbounded_Integer types to deal= =20 with huge integers, in contrast to strings. ------ I love the taste of Cryptanalysis in the morning! ------ --Stefan.Lucks (at) uni-weimar.de, Bauhaus-Universit=E4t Weimar, Germany-- --8323329-1947109751-1365165956=:30208--