On Mon, Jul 29, 2013 at 2:36 AM, William ML Leslie <
[email protected]> wrote:

> You said:
>
> "Add the trait-instance as an argument ... to the module boundary".
>

I was mis-recollecting a paper by (I think) Bob Harper. What I was thinking
about wouldn't be tolerable in practice.


> When I went back and read that (at the end), I thought you meant that
> a module that selects an instance for a given type should be
> parametrised by that instance, if the selection isn't local.  Which is
> a very nice idea, I think.


Yeah, I was thinking in exactly that direction. What's wrong with it is
that type variables are scoped at the function, and promoting the type
classes causes you to promote the type variables. So now you have some
module with five procedures, each of which is parametric over 'a and each
of which has an unresolved instance. So you end up at the module layer with
five instances and five types that need to be stated at module import, all
of which in practice will turn out to be the same, because after all the
functions in this module are inter-related.

But then you'll have multiple instantiations of the module. And somewhere
in there you'll have a top-level mutable global. Now when you instantiate
this module, how many copies of that mutable global to you get, and at how
many types??

What you'll conclude is that modules just became objects. Which has been
tried in a couple of languages, and it's interesting, but I don't think
it's quite what we are after here.


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

Reply via email to