On Tue, Jun 24, 2014 at 10:37 AM, Jonathan S. Shapiro <[email protected]> wrote:
> I'd like to open a discussion on something I am weak about: the interaction
> between subtyping, inference, and termination.
I'm not sure this is helpful at all, but its something i've noticed
recently (and been meaning to investigate more thoroughly)... In SML
there appears to be some interplay between flex records, type
inference and currying, such that the initial let statement works
correctly, but the latter let statement does not due to the unresolved
flex record in 'val x = #x', (not knowing the rest of the fields in
the record/location of #x).
while its definitely not subtyping (the need for multiple getFoo(#x)
calls, i found it interesting, the ability to delay the type checking
until complete type information was available at the callsite...
though maybe obvious to people more familiar with SML than myself, I
don't know...
val p1 = {x=0, y=0};
val p2 = {x=1, y=1};
val p3 = {x=1, y=1, z=1};
fun getFoo(field) = fn record => field record;
let val getX_2d = getFoo(#x)
val getX_3d = getFoo(#x)
val getZ_3d = getFoo(#z)
val x1 = getX_2d(p1)
val x2 = getX_2d(p2)
val x3 = getX_3d(p3) in
(x1, x2, x3, getZ_3d(p3))
end
let
val x = #x
val x1 = x(p1)
val x2 = x(p2) in
(x1, x2)
end
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev