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 String, Wide_String, Wide_Wide_String, and whatever comes next has historical reasons. It makes mixing narrow, Wide_ and Wide_Wide_ Strings worse than mixing reals and integers. > Unicode strings, all of them, are semantically exactly same except for > 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 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 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 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 using memory addresses and pointer arithmetic. If you *have* to do it, perhaps because you have to support some legacy interfaces, with different string types, you better hide the input/output stuff in some low-level packages, and use a single kind of string in your application logic (perhaps Wide_Wide_String, if the memory isn't too small). Of course, a single common root type for String, Bounded_String and Unbounded_String would come handy -- similarly another root type for the Wide_ and yet another for the Wide_Wide_ family. But note that not even Universal_Integer does provide such a root type! The Standard(-Library) did not even define any Bounded_Integer or Unbounded_Integer types to deal with huge integers, in contrast to strings. ------ I love the taste of Cryptanalysis in the morning! ------ --Stefan.Lucks (at) uni-weimar.de, Bauhaus-Universität Weimar, Germany--