On Wed, May 23, 2012 at 11:56 PM, Bennie Kloosteman <[email protected]>wrote:
> What I was really asking why not String : array<UniChar> { SubStr
> etc.. } . With mutable /immutable semantics its gets more interesting.
>
Yes. Yuck. There are *compelling* reasons to keep strings immutable. The
need for something like StringBuilder is unfortunate, but it actually is
better than allowing strings to be mutable.
> > This is actually a good example of a place where having a Nat kind helps.
>
> That lost me …I can make some guesses but I don't think your referring
> to natural number type .
>
You are right. I'm referring to a natural number *kind*. That is: one in
which a fixed integer length can be made part of the type explicitly within
the language.
The problem with vector bounds checking is not that the bound is variable.
It is that the slot containing the reference to the vector is mutable. If
the slot were immutable, you could do the bounds check at top of loop and
declare victory. Because the slot is mutable, you cannot assume in general
that you are dealing with the same vector each pass through the loop. In
consequence, the bounds checks cannot be lifted. This is particularly a
concern when vectors get hidden behind properties or inline functions. You
would think that inlining would expose the bound for hoisting and
elimination, but it doesn't.
shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev