http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconcasts.asp
----Original Message Follows----
From: "Todd Berman" <[EMAIL PROTECTED]>
To: "'David La Motta'" <[EMAIL PROTECTED]>,"'Arild Fines'" <[EMAIL PROTECTED]>
CC: "'Jonathan Pryor'" <[EMAIL PROTECTED]>,"'Mono-List'" <[EMAIL PROTECTED]>
Subject: RE: [Mono-list] implicit, explicit, and why does C# have these?
Date: Fri, 17 Oct 2003 10:07:18 -0400
Well, implicit casting between Truck and Pear would be up to the API designer.
If for some reason s/he decides that you can implicitly cast between the two based on something, no clue what though, it's not the language that is to blame, but the developer.
C# just provides the developer with the tools to create a OO API that makes *sense* to the end user with implicit and explicity casting, nothing more :)
--Todd
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David La Motta Sent: October 17, 2003 9:56 AM To: Arild Fines Cc: Jonathan Pryor; Mono-List Subject: Re: [Mono-list] implicit, explicit, and why does C# have these?
I guess I should expand on my [sort-of] gripe.� Implicit casting by the language itself is OK where it makes sense, like in your example of int and long.� But, logically, it can be confusing to use an implicit operator to convert between objects that have nothing in common, and never will (like Truck and Pear, for instance).
// David
Arild Fines wrote:
David La Motta wrote:
Thanks for the explanation. I can see how the implicit operator can be useful in the example you describe; still, I think it wasn't necessary for C# to expose them to us. I.e., let us deal with the explicit casts and spare the confusion they may cause. In other words, an implicit cast from a Pear object to a Truck object can seem quite odd, assuming their inheritance tree has nothing in common.
Sure, but would you really want to be required to use an explicit cast when converting an int to a long?
-- Arild
AnkhSVN: http://ankhsvn.tigris.org Blog: http://ankhsvn.com/blog RSS: http://ankhsvn.com/blog/Rss.aspx
King Crimson lives in different bodies at different times and the particular form which the group takes changes. When music appears, which only King Crimson can play then, sooner or later, King Crimson appears to play the music
_______________________________________________ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
_________________________________________________________________
See when your friends are online with MSN Messenger 6.0. Download it now FREE! http://msnmessenger-download.com
_______________________________________________ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
