On Sun, Apr 8, 2012 at 5:28 PM, Sandro Magi <[email protected]>wrote:
> On 08/04/2012 3:06 PM, Jonathan S. Shapiro wrote:> * The
> "non-overlapping instances" rule defies specialization. There
> > are /many/ examples where I want to have a general (polymorphic)
> > type class that has specialized implementations at certain types.
> > For example, I want Collection('a) having a generally parametric
> > instance, but simultaneously having a specialized instance at
> > Collection(char).
>
> This semantics always struck me as odd as well, though I've convinced
> myself that Haskell's trivial solution is mostly workable, which is why
> it hasn't been fixed yet. Namely, just define a newtype and declare an
> instance for the new type...
>
That is *not* a workable solution in the large.
Never fix a major chest wound with a band aid!
> > The second issue with type classes is more subtle, and mainly has to do
> > with operator overloading...
>
> The obvious solution seems to simply provide a single guarantee:
> efficient code generation/inlining of these overloads only when whole
> program compilation is possible.
So it's okay, in your view, to achieve performance only for a set of
programs of size zero?
No. Separate compilation has to work.
> Perhaps the problem was really trying to co-opt type classes for laying
> out record structures....
No, no. It had absolutely nothing to do with layout, and we didn't
introduce it for that reason in any case.
shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev