Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!chalmers.se!appli!niklas From: niklas@appli.se (Niklas Hallqvist) Newsgroups: comp.std.c++ Subject: Re: implicit type conversions considered harmful: X3j16 "contractions" WG Message-ID: <1310@appli.se> Date: 27 Mar 91 22:06:11 GMT References: <4628@lupine.NCD.COM> <1991Mar26.013025.3173@kodak.kodak.com> Organization: Applitron Datasystem AB, GOTHENBURG, SWEDEN Lines: 44 cok@islsun.Kodak.COM (David Cok) writes: :In article tom@ssd.csd.harris.com (Tom Horsley) writes: : [ Prior post deleted about not having implicit conversions] :> :>I agree with this, and I don't even care how hard it is to implement the :>overload resolution rules. I just want to write code that really does type :>checking and only does the conversions where I say "I really meant that." :> :>Right now in C++, if I define my own type conversion functions (because I :>actually do need to use them sometimes), I can't get any error messages out :>of the compiler, because it thinks it is OK to implicitly apply the :>functions. (I suppose the compiler could be made to generate a warning :>or caution in this case, but that would cause its own set of problems, :>and most (all?) compilers don't generate such messages). :> :>I can't get the benefit of strong type checking and also provide a way to :>do the conversions naturally. (Yes, I know I can get around it other ways, :>like defining lots of silly generator functions or something like that). :I, on the other hand, like implicit conversions, but agree with the sentiment :that wishes that they could be controlled. Use constructors and operator X :to define what explicit conversions are allowed and then some other :mechanism to say which of these explicit conversions should be used as :automatically applied implicit conversions. The two concerns should be made :more orthogonal. Yeah, that sounds fine! What about yet another overloading of an existing keyword? (Don't we all just LOVE reusing keywords :-) operator int() auto; Well, I'm not too concerned about pushing this issue. I just thought up the syntax. This would of course break lots of existing code. So... It needed rewriting anyway ;-> Niklas -- Niklas Hallqvist Phone: +46-(0)31-40 75 00 Applitron Datasystem Fax: +46-(0)31-83 39 50 Molndalsvagen 95 Email: niklas@appli.se S-412 63 GOTEBORG, Sweden mcsun!sunic!chalmers!appli!niklas