On Fri, 5 Apr 2013, Dmitry A. Kazakov wrote: > On Fri, 5 Apr 2013 21:02:43 +0200, Stefan.Lucks@uni-weimar.de wrote: > No, I insist that it is up to the programmer to decide whether two types to > become compatible (relative) or not. Character and Wide_Character are > evidently relative. Integer and Float are "evidently relative". > I disagree. They wanted to prevent the mess of PL/1 where *arbitrary* > conversions were applied to semantically unrelated types. Types like > Character and Wide_Character are semantically related. Conversion from one > to another is perfectly well defined. The same for conversions between Integer and Float. >> Sure, some cases where implicit conversions take place >> exist, but only very few. One example is the conversion of constants of >> type Universal_Something into the right type. > > It makes sense in all cases where types are related. This is simply the > definition of a type S being a subtype of T <=> S is substitutable for T. And Integer is substitutable for Real. > If representations are different the substitution is done per conversion. > Not a rocket science, really. Clearly, the designers of Ada where reluctant to define an implicit conversion from Integer to Float. I am glad about that -- it frequently helps me catching errors. Similarly for the distinction between different String types. Sure, explicit conversions, are sometimes annoying, and so is the mess with constants. That is the same for string types as for arithmetic ones. E.g. I frequently get caught by the compiler writing, say, "2" where I would have to write "2.0" for a constant Float. > And it is all up to the programmer to tell the compiler that S must be > considered a subtype of T, whatever representation both might have is not > language's business. Arithmetic types and String types are in the same boat here. There is no logical reason to allow implicit conversions for one class and not for the other one. ------ I love the taste of Cryptanalysis in the morning! ------ --Stefan.Lucks (at) uni-weimar.de, Bauhaus-Universität Weimar, Germany--