On 07/01/2014 4:38 PM, Jonathan S. Shapiro wrote:
I think Keean on LtU said it very well. If we set aside the existential encapsulation for a moment, then TCs are compile-time polymorphism where Interfaces are run-time polymorphism.

I just want to note that there's been a lot of discussion on LtU about this assertion. The conclusion was that "runtime" polymorphism really comes down to what extent the polymorphism is first-class. Languages limited to rank-1 polymorphism can be easily elaborated in a compile-time only setting as polymorphism is second-class (just like TCs themselves). Rank-2 polymorphism (dual to existentials) requires a little more runtime support, rank-3 even more so, ..., etc. Polymorphic recursion has similar consequences for "runtime polymorphism".

In summary, TCs aren't compile-time polymorphic any more than interfaces. What matters is purely what type the TC is indexed on. If you limit the indexes to only monotypes, then TCs are compile-time only. But this is akin to allowing no dynamic linking, which means you can perform a defunctionalization on all interface uses and achieve the same effect in the context of interfaces, so interfaces too are also compile-time only given these assumptions.

Some interesting discussion and examples in that thread for the curious.

Sandro

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

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

Reply via email to