If the rule for bindings of the form:

(define a b:(mutable x))

is that a receives a copy of b -- mutability shallowly lost due to copy,

Consider:

(define a (mutable 10))

The type of a is int and NOT (mutable int) , mutability shallowly lost due to copy.

The mutable value constructor is actually never useful (It did make the 10 mutable, but the effect never survives). So I think we should probably remove it from the language.

One can always write:

(define a:(mutable 'a) (mutable 10))

or even

(define a:(mutable 'a) 10)

This is actually good because mutability concerns the cell containing 'a' and not the value that is contained there, and the mutable qualification is better expressed along with a.

Also, if I have a variant:

(defunion (list 'a) (Nil) (Cons (mutable 'a)))

(define alist (list int))

The mutable qualifier in the argument of Cons is useless because, alist is itself not mutable, and there is no way in the language (and rightly so) to name the argument of Cons and independently mutate it.

[Just for reference: In Ocaml, the mutable qualifier can syntactically only appear on field names of records]

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

Reply via email to