> First, as I've mentioned elsewhere, [passing traits by explicit paramater]
> simply doesn't work (pragmatically) when unboxed types are admitted into
> the language. Second, this induces a requirement for whole-program
> compilation in order to inline the instances.


Can you explain why this is? I'm assuming the CLR, with JIT, polymorphic
inline caches, parametric instantiation. Why would this require
whole-program compilation or create an inlining problem?

The code below compiles *today* in CLR, and AFAIK will instantiate and
inline ordForNumbers... Aren't we just talking about extending this
behavior over type-classes (aka, sets of delegates). What am I missing?

public delegate int ordTrait<T>(T first, T second);

public void sort<T>(T[] elements, ordTrait<T> suppliedOrd) {
   // ...
}

public int ordForNumbers(int first, int second) {
   return first.CompareTo (second);
}

public void doSort() {
   int[] nums = {1,2,3};
   sort(nums,ordForNumbers);
}
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to