digitalmars.D - [proposal] How to overload opCast
- Dusty (15/15) Aug 16 2005 Good day!
- Chris Sauls (4/20) Aug 16 2005 Its been proposed a dozen times before. And I for one still stand stron...
- Shammah Chancellor (4/24) Aug 16 2005 I'm in favor as well, and was considering posting something exactly like...
-
Stewart Gordon
(8/12)
Aug 16 2005
- Ben Hinkle (9/27) Aug 16 2005 I'm curious what you were coding that requires overloaded opCast (and,
Good day! The one substantial drawback of D in comparition with C++ is that in D is impossible to write more than one opCast per type. The reason is inability of lincer to resolve different functions basing on respective return types. But D - opposing to C++ - have "out" parameter modifier. So linker can easy choose between proper functions: So I propose to add respective variants as valid choise when compiler resolve code like Dusty.
Aug 16 2005
Dusty wrote:Good day! The one substantial drawback of D in comparition with C++ is that in D is impossible to write more than one opCast per type. The reason is inability of lincer to resolve different functions basing on respective return types. But D - opposing to C++ - have "out" parameter modifier. So linker can easy choose between proper functions: So I propose to add respective variants as valid choise when compiler resolve code likeIts been proposed a dozen times before. And I for one still stand strongly in support of it. The fact that it keeps on coming back up proves that it bears consideration. -- Chris Sauls
Aug 16 2005
In article <dds8rs$2n8u$1 digitaldaemon.com>, Chris Sauls says...Dusty wrote:I'm in favor as well, and was considering posting something exactly like this a few weeks ago! -ShaGood day! The one substantial drawback of D in comparition with C++ is that in D is impossible to write more than one opCast per type. The reason is inability of lincer to resolve different functions basing on respective return types. But D - opposing to C++ - have "out" parameter modifier. So linker can easy choose between proper functions: So I propose to add respective variants as valid choise when compiler resolve code likeIts been proposed a dozen times before. And I for one still stand strongly in support of it. The fact that it keeps on coming back up proves that it bears consideration. -- Chris Sauls
Aug 16 2005
Dusty wrote:Good day! The one substantial drawback of D in comparition with C++ is that in D is impossible to write more than one opCast per type. The reason is inability of lincer to resolve different functions basing on respective return types.<snip> Several proposals have been made for multiple cast operators. http://www.wikiservice.at/wiki4d/wiki.cgi?FeatureRequestList Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on on the 'group where everyone may benefit.
Aug 16 2005
"Dusty" <Dusty_member pathlink.com> wrote in message news:dds783$2lv5$1 digitaldaemon.com...Good day! The one substantial drawback of D in comparition with C++ is that in D is impossible to write more than one opCast per type. The reason is inability of lincer to resolve different functions basing on respective return types. But D - opposing to C++ - have "out" parameter modifier. So linker can easy choose between proper functions: So I propose to add respective variants as valid choise when compiler resolve code like Dusty.I'm curious what you were coding that requires overloaded opCast (and, actually, what required an opCast at all). Note "cast(char[])a" in D would normally be code up as "a.toString()". Also D doesn't let you add to the set of implicit conversions the compiler tries to apply. All overloading has to happen on explicit casting expressions cast(Foo)bar. D is much less free-wheeling than C++ when it comes to implicit and explicit conversions and overloading.
Aug 16 2005