[bitc-dev] Why lexical scoping for type classes?
Jonathan S. Shapiro
shap at eros-os.com
Fri Nov 21 11:09:50 CST 2008
A comment came to me in private mail, and I felt that this was a better
place to answer it. The author wrote:
I do like your notion of type classes working with lexical scope, but have
no idea how it will play out in a real language.
I think it is safe to say that *we* don't know how it will work out either,
but here is the thinking (such as it is):
1. The present "no collisions allowed" rule really violates separate
compilation. It is the type of rule that is *guaranteed* to get violated
by libraries at some point, and is therefore not well suited to a language
where we hope that useful libraries will emerge.
2. The other problem with type classes is specializations. The problem is
that choosing the "best" specialization is inherently ambiguous (it's the
same problem as C++ overload resolution). Pushing that back into the lexical
context doesn't solve the ambiguity, but it does put the control of
resolution order into a place where the programmer can control it
explicitly.
shap
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.coyotos.org/pipermail/bitc-dev/attachments/20081121/48ff8d5d/attachment.html
More information about the bitc-dev
mailing list