🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #990

Re: implicit type conversions considered harmful: X3j16 "contractions" WG

#990
From: Niklas Hallqvist
Date: Wed, 27 Mar 1991 22:06
44 lines
2614 bytes
cok@islsun.Kodak.COM (David Cok) writes:

:In article <TOM.91Mar25123217@rcx1.ssd.csd.harris.com> 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
Technical Details
Message-ID: <1310@appli.se>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!chalmers.se!appli!niklas
References: <4628@lupine.NCD.COM> <TOM.91Mar25123217@rcx1.ssd.csd.harris.com> <1991Mar26.013025.3173@kodak.kodak.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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> <TOM.91Mar25123217@rcx1.ssd.csd.harris.com> <1991Mar26.013025.3173@kodak.kodak.com>
Organization: Applitron Datasystem AB, GOTHENBURG, SWEDEN
Lines: 44