Jonathan S. Shapiro wrote:
> On Wed, 2008-03-12 at 18:17 -0400, Swaroop Sridhar wrote:
>> So, are you suggesting that if we write (by-ref 'a), where 'a cannot
>> unify with a mutable type? This cannot be the case since the type
>> variable must be able to unify with any type.
>>
>> Prof. Shapiro suggested introducing a notion of (immutable t) as a type.
>> So, we can write (fn ((by-ref (immutable 'a))) ()) to represent a
>> function that only accepts a immutable by-reference argument.
> 
> A type system that has all of IMMUTABLE, MUTABLE, and parametric types
> runs into convergence problems. What we *could* do (Swaroop and I
> discussed this offline today) is introduce (IMMUTABLE 'a) where the
> argument to immutable can only be a type variable, with the meaning "'a
> cannot unify with a mutable type".

When we eventually get to introducing the immutable construct, I think
it is better to introduce it in the form of a constraint

ex: (forall (Immutable 'a) 'a)

rather than as a constructor (immutable 'a).

 From an implementation point of view, either version is not a problem,
but I think introducing immutable in the form of a constructor (as
analogous to the mutable constructor) is confusing to the programmer.
Isn't it is really constraining the type variable 'a, and not
constructing a new type?

Swaroop.
_______________________________________________
bitc-dev mailing list
bitc-dev@coyotos.org
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to