[bitc-dev] Type classes as types
Jonathan S. Shapiro
shap at eros-os.org
Fri Feb 11 23:08:29 PST 2011
Regrettably, shap is (once again) an idiot, and interfaces are NOT merely a
sugaring on type classes. It's amazing the things I realize in the shower
when I am short on sleep:-)
The important distinction is that an Interface encapsulates an existential
type - the type of the target object. An instance of an interface consists
of a reference to some unknown type Tobj and a set of *member functions*
accepting that reference as their "this" pointer.
A type class does *not* do any type hiding, which is why it has methods
rather than member functions.
This does point out, however, that my use of the term "method" for
"structure method" is, at best, confusing, and that I should replace that
keyword with "member" in order to reinforce the distinction. The original
choice was driven by SmallTalk terminology, but because of the simultaneous
presence of type classes it is a source of confusion.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the bitc-dev