[bitc-dev] Type compatibility at application
Swaroop Sridhar
swaroop.sridhar at gmail.com
Fri May 19 12:53:16 EDT 2006
Jonathan S. Shapiro wrote:
> Currently, if a procedure accepts type T, it is legal to pass a value of
> type (mutable T) -- the copy strips mutability.
>
> In principle, this could be extended: a procedure accepting (ref T) can
> safely be passed a value of type (ref (mutable T)) [note that the
> reverse is not true, because this is not a value copy].
>
> This can be extended further: a procedure accepting (vector T) can
> safely be passed a value of type (vector (mutable T)).
>
> Things do get trickier for arguments of procedure type, because of
> contravariance issues.
>
> Which of these subtypings should be permitted in the context of
> procedure application?
>
> The reason I ask is that I am concerned about the number of cases that
> may require polyinstantiation due to mutability. I do not have any
> intuition about how important this is.
Why does this require polyinstantiation? The type of the procedure never
changes. The type of the copy of arguments is exactly equal to that
expected by the function call.
Swaroop.
More information about the bitc-dev
mailing list