> I don't think it is fully implemented in the current implementation, > but BitC already provides a mechanism for ad-hoc polymorphism over > structures through the built-in "has-field" constraint. This takes the form...
To me, ad-hoc polymorphism is not as important as parametric polymorphism. Though, it seems to me the method you describe is one that would constrain the set of types over which a generic function could be applied. > > What I am imagining is that we think of virtual functions as consisting of > an "ordered union type". That is: a sequence of types of progressively > decreasing desirability. Go uses a similar concept since it disallows inheritance in favor of aggregation. It implicitly forwards method calls of aggregated interfaces. I find it a reasonable alternative to inheritance. http://golang.org/doc/effective_go.html#embedding Note they only allow disjoint sets of methods to be included into an interface. So there is no resolution order required. Unless the ordering were explicit, I might find it annoying to debug large projects, if I had to traipse through code to determine which function was being called. >>Fast Forward>> I think what I am struggling with is the implicit vs. explicit object > notion. So far as I can tell, the difference is that explicit objects > instantiate their class's type variables, and in doing so, form a > representation. Implicit objects instantiate *none* of their class's type > variables, and thereby serve as constraints only, wherein the ability to > instantiate an object of the appropriate class type (which is stateless and > therefore costs nothing to instantiate) serves as witness of membership in > the class relation. > IMO, the only advantage of explicit classes is found in languages which don't have builtin garbage collection. The explicit nature of constructors and (especially) destructors, better allows a programmer to babysit resources. If BitC is intended to be GC optional, this might be a compelling enough reason. As a matter of taste, I don't care for them, but I see one benefit and no real detriments that I can think of. My beef with objects is the rest of the OO system, namely inheritance.
_______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
