[Mono-list] implicit, explicit, and why does C# have these?
Kenneth Brubaker
kennethbrubaker@hotmail.com
Thu, 23 Oct 2003 06:52:30 -0500
If you want a dumbed down language, then use VB.NET, also known as .NET for
Dummies. Remember, C# is used by the Framework Developers themselves. If you
are doing class library development in .NET, there is no better language
than C#. A bit trickier for the implementer but easier for the consumer. It
would be good to follow the .NET Class Library Guidelines on the effective
use of implicit casts:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconcasts.asp
----Original Message Follows----
From: "Todd Berman" <tberman@gentoo.org>
To: "'David La Motta'" <dlamotta@email.com>,"'Arild Fines'"
<arild.fines@broadpark.no>
CC: "'Jonathan Pryor'" <jonpryor@vt.edu>,"'Mono-List'"
<Mono-list@lists.ximian.com>
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: mono-list-admin@lists.ximian.com
[mailto:mono-list-admin@lists.ximian.com] 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 - Mono-list@lists.ximian.com
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