On Fri, Mar 6, 2009 at 3:08 PM, Swaroop Sridhar <[email protected]> wrote:
> So, the rule is we use is that all instances in scope at any point of
> time can be used, but the instances at the callee override the instances
> of the caller, right?

Well, that's not the current rule and it's not the currently proposed
rule. The issue hiding in here is the one that I just mentioned; what
are the rules for extending the instance environment as instantiation
proceeds. There are several possible answers, all of which can be
clearly specified, and all of which are undesirable in some cases.

> One issue that I think we must consider here is the effect on
> optimization, similar to the effect of vtable dispatch.
> For example, if different instances of Eq char are defined in the
> modules where f and g are defined, the instance at f overrides the one
> in g. So, the (== 10 20) expression in g cannot be optimized at compile
> time (even if a satisfying instance is available) since its meaning
> differs with respect to different calls. We can only perform these
> optimizations at link time.

Very good example. This particular case is one of the reasons that
those particular instances are in the prelude.
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to