[Mono-list] implicit, explicit, and why does C# have these?
Fri, 17 Oct 2003 10:07:18 -0400
Well, implicit casting between Truck and Pear would be up to the API
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 :)
[mailto:email@example.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.=A0 Implicit casting by =
language itself is OK where it makes sense, like in your example of int
and long.=A0 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).
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
converting an int to a long?
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