On Sat, Apr 2, 2011 at 7:01 AM, Sandro Magi <[email protected]> wrote:

> Type classes are just post-hoc interfaces, so you're no longer limited to a
> declaration-time hierarchy.
>

This is not quite true. First, interfaces (at least in Java/C#) are
populated by member functions. The "methods" of an interface therefore have
presumptive access to "internal" object state that is not generally
available. This is not true of type classes.

Second, it's important to note that no current language defines any
interface notion on structs (as opposed to classes). This means that an
interface object, and the class instance that it wraps, are reference types.
This has *huge* implications for compilation.


> The real question is inheritance. In what ways is inheritance useful? From
> what I can see, it's most useful application are default implementations of
> methods. But this can be provided by type classes as well. Subtyping too.
>

Q1: How is this provided by type classes when there is more than one level
of derived class?
Q2: How is subtyping provided by type classes?


> So type classes are strictly more general than inheritance and interfaces.
> Only downcasting/upcasting isn't provided by default, but has been provided
> by libraries.
>

Pointer to papers on "provided by libraries"?


> Do you have some argument or examples that contradict this conclusion? What
> sort of scenarios push you toward a traditional OO structure?
>

This deserves a response of its own.

shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to