> > Now, if you tried to do Method(10) the compiler wouldn't know what to
> > do. It could look for a conversion from int to Foo, but it couldn't
[quoted text clipped - 5 lines]
> Point taken Jon, but that involves an implicit cast, which muddies the
> picture. I'm not doing that.
No, but how is the compiler meant to know that? Currently, it's a very
simple rule - if you expose something in your public API, the users of
that API need to know about that type. It sounds to me like you're
proposing something much more complicated - and that always makes me
very nervous.
> To continue your analogy, I'm explicitly passing in a Foo, but the
> compiler's still not up to the job. As I see it, this is a
> fundamental problem with dotNet's principle of binding an assembly's metadata
> into the assembly itself. In C/C++ we didn't do that - the metadata went in a
> header file and the compiler only used that.
Yes, and we've seen how easy it was to work with that, haven't we? ;)
> It looks as though dotNet can't handle this.
Indeed. And personally, I prefer the nice and simple model.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Michael Brooks - 16 Mar 2006 19:08 GMT
> Currently, it's a very
> simple rule - if you expose something in your public API, the users of
> that API need to know about that type.
If that's the case, how come it all compiles OK when I change the names of
my overloaded methods to differing names? I'm still exposing the WebControl
in my API, but the compiler no longer seems to mind. That implies that there
is a level of intelligence in there more advanced than the simple rule that
you state above - it only gets confused when handling overloads. Any thoughts?
Jon Skeet [C# MVP] - 16 Mar 2006 23:38 GMT
> > Currently, it's a very
> > simple rule - if you expose something in your public API, the users of
[quoted text clipped - 5 lines]
> is a level of intelligence in there more advanced than the simple rule that
> you state above - it only gets confused when handling overloads. Any thoughts?
That surprises me, to be honest. I guess at that point the compiler
hasn't had to make *any* decisions at all about types that it doesn't
know about. It still doesn't seem unreasonable to me that the compiler
should complain when it's asked to make decisions involving types it
hasn't the faintest idea about.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too