On 8 January 2015 at 11:28, Keean Schupke <[email protected]> wrote:
> Sorry, realised I only answered the second part. I also want to point out
> that there is more than one way to do everything, and certainly dependent
> types with aggressive partial-evaluation would work, and possibly be more
> expressive than the option I am presenting. The advantage of my proposal is
> it makes explicit to the programmer the cost of runtime polymorphism, IE it
> only occurs where the programmer permits it. With dependent types static
> polymorphism (and the improved performance) can only come where optimiser
> can prove it does not need to be dynamic. With a perfect compiler these
> would be the same, but with the former you have visibility of the cost in
> the source code, with the latter a much more complex compiler.

The machanism we came up with last time was quite smart from memory,
although I can't seem to find it now.

It looked something like this:

Instances could be declared `inline`.

If a function depended on a class that had (within its lexical
contour) inline instances, it would be polyinstantiated and
specialised on the class argument.  This didn't impact the type in any
way, inline could be ignored for typing reasons.

When compiling callers of the function, we would check if the instance
passed (usually, infered) was one of the instances the callee had been
specialised for.

On 8 January 2015 at 10:28, Jonathan S. Shapiro <[email protected]> wrote:
> What I'm suggesting for now is that in order to be considered as a default
> (implicit) resolution, the instance must be a witnessably coherent instance.
> If the contours don't guarantee that violations of coherence are witnessed,
> then the instance is presumptively not coherent, and can only be used in
> explicit instance resolutions.

I'm not sure why the callee cares about the instances available for
inference to the caller.

-- 
William Leslie

Notice:
Likely much of this email is, by the nature of copyright, covered
under copyright law.  You absolutely MAY reproduce any part of it in
accordance with the copyright law of the nation you are reading this
in.  Any attempt to DENY YOU THOSE RIGHTS would be illegal without
prior contractual agreement.
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to