Jonathan S. Shapiro wrote:
There is no intrinsic problem in the type system with this
instantiation, but it has an unpleasant consequence: deeply immutable
procedures cannot invoke methods because they may later be instantiated
in a way that violates deep immutability.
How do type classes propagate over interfaces? Are definstances
declared locally in imported interfaces available without declaration in
the interface definition? If they can not propagate over the interface
boundary without being defined in the interface, then this case should
already be covered. We have two interface types defined: mutable and
immutable. It should be clear to the programmer when importing an
interface may contain stateful functions, and thus stateful type class
instances.
If type class instances can propagate over the interface boundary
without being defined in the interface, then I agree that additional
syntax is needed.
3. Introduce a new variation on function types:
(di-fn T.arg T.result)
that describes deeply immutable procedures.
If I declare a di-fn using a type class, other future instances of that
type class could cause my function to become stateful. An additional
definstance in another interface will flag errors on an unchanged
function. I feel that additions to programs should not cause errors
elsewhere whenever possible. I would like to propose deeply-immutable
type class definitions as an alternative. Determining which functions
are deeply immutable should be simple in either case.
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev