Type classes provide for ad-hoc overloading on type. C++ member functions can be overloaded on type (I'm leaving global overloading aside for a moment).

It seems to me that we can choose to interpret what's happening in C++ in the following way: 1. All C++ functions take a single argument of tuple type. 2. The definition of a member function C::f in a C++ class implicitly introduces a type class scoped by C, containing a single type class method f. The body of the definition of C::f becomes the body of an instance method of this type class. Note that the resulting type class C::f is a closed type class. What is wrong with this view? Certainly it doesn't account for other aspects of the C++ type system, but is it sufficient to account for type-based overloading? I know it doesn't account for resolution order. If this view is basically OK, why can't this intuition also be applied to global functions, aside from the fact that this will raise a chorus of disgust from type system purists? There are other reasons to have type classes, and I'm not proposing to remove them. I'm just asking whether they provide a basis for understanding this behaviour in C++. shap

_______________________________________________ bitc-dev mailing list bitc-dev@coyotos.org http://www.coyotos.org/mailman/listinfo/bitc-dev