> A deeper inference on the constraint gives us the offsett of #name
> into 'this', and the type returned, etc, and this gives us a basis for
> judging the equivalence of T1.foo and T2.foo, and a way to compare the
> compatibility of a deeply infered constraint with a type as a basis
> for whether its safe to cast


I personally don't think casting is the right way. Type driven dispatch (as
in type-classes) seems a much better approach.

What would be interesting, would be a type-class driven case statement:

case (x :: Thing => t) of
    (t :: Link) ->
    (t :: Ageable) ->
    (t :: ObjectHeader) ->
    otherwise ->

Obviously this is only useful if the type can be statically determined.

I think open-data types are a good way to deal with runtime polymorphism.

Something that concerns me is the duplication of functionality at the value
and type level. I would like to keep types completely statically
determinable at compile-time, and use datatypes for runtime "polymorphism".
To balance the features, it would make sense to allow open datatypes, and
closed type classes.

Then extensible records provide the 'inheritance' like behaviour at the
value level, with precise 'struct' like layouts, and type-class constraints
on type-classes similar inheritance for type-classes, but logically and
without any implied structure.

I wonder if existential types are even necessary if you have an open "sum"
type like:

data Thing = L Link
data Thing += A Ageable

-- some other code

data Thing += OH ObjectHeader


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

Reply via email to