Thanks, it seems I was confused by the const keyword from C++, where it's essentially always a part of the type.
But it's still confusing. Comparing this to C++, it looks like this "v" has some "magic type" - it's a variable binding, but it has something like a "flag" or something on it (from the view of the type system) which says "mutable" or "immutable", but this flag isn't part of the type I can specify, that is, it's not accessible to me?
Or is it something like: Types are not immutable/mutable as of themselves, but variable bindings to them are?
If so, I'm still slightly confused when you throw references into the mix: is being a reference a part of the binding, or part of the type? I'd guess it's part of the binding, but I'm not sure.
And in your last example, this is also confusing. From what I understood, I'm not so sure you change an immutable variable into a mutable one. I think that a new variable binding is introduced which shadows the previous binding since they have the same name, so they're conceptually different "v"s. Of course for all practical purposes we can treat this like the "v" binding changed its binding type.