On Sun, 2008-07-20 at 21:38 -0400, Jonathan S. Shapiro wrote:
> My personal preference is that mutability should be defined path-wise.
> Prohibiting mutation on an inner, immutable field that is part of a
> larger mutable cell merely imposes a copy burden on the compiler and the
> programmer.
Hmm. It isn't quite so simple, because we have to think a bit carefully
about what happens to type unification at initialization time. If we
have
(define p:(mutable 'a) (pair 1:int32 #\c))
then the question is whether
(let ((myChar p.snd))
..)
should cause myChar to be mutable.
I think the issue here is copy vs. reference. If an inner reference is
made, mutability must be treated pathwise. If a copy of a value type is
made, then I think this is not necessary or desirable.
Under this reasoning, assignment should follow the reference rule,
because the "signature" of set! is
(forall (copy-compat 'a 'b)
(fn ((by-ref (mutable 'a)) 'b) ())
shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev