Article View: comp.std.c++
Article #971Re: implicit type conversions considered harmful: X3j16 "contractions" WG
From: Tom Horsley
Date: Mon, 25 Mar 1991 17:32
Date: Mon, 25 Mar 1991 17:32
37 lines
2657 bytes
2657 bytes
>>>>> Regarding implicit type conversions considered harmful: X3j16 "contractions" WG; rfg@lupine.ncd.com (Ron Guilmette) adds:
rfg> Well guess what! The C++ feature which allows user-defined type conversion
rfg> operators to be *implicitly* applied (in some contexts) is "the GOTO of
rfg> strong typing".
rfg> Need I say more?
rfg> P.S. If we got rid of implicit applications of user-defined type
rfg> conversions (while still allowing for *explicit* applications of
rfg> user-defined type conversions) I estimate that the current (enormous)
rfg> complexity of the overload resolution rules would be cut in half. That
rfg> would give the implementors more time to work on other little problems
rfg> (e.g. optimization).
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).
--
======================================================================
domain: tahorsley@csd.harris.com USMail: Tom Horsley
uucp: ...!uunet!hcx1!tahorsley 511 Kingbird Circle
Delray Beach, FL 33444
+==== Censorship is the only form of Obscenity ======================+
| (Wait, I forgot government tobacco subsidies...) |
+====================================================================+
Technical Details
Message-ID:
<TOM.91Mar25123217@rcx1.ssd.csd.harris.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!uflorida!travis!tomReferences:
<4628@lupine.NCD.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!uflorida!travis!tom From: tom@ssd.csd.harris.com (Tom Horsley) Newsgroups: comp.std.c++ Subject: Re: implicit type conversions considered harmful: X3j16 "contractions" WG Message-ID: <TOM.91Mar25123217@rcx1.ssd.csd.harris.com> Date: 25 Mar 91 17:32:17 GMT References: <4628@lupine.NCD.COM> Sender: news@travis.csd.harris.com Organization: Harris Computer Systems Division Lines: 37 In-reply-to: rfg@lupine.ncd.com's message of 25 Mar 91 09:10:29 GMT