Derek Parnell wrote:
Walter, you have side-stepped the problem in question by talking about a
totally different problem.

It's the same issue. When you use a cast, you are subverting the type system. That means you have to be sure you are doing it right. The compiler cannot help you.

Burtons code says "b is invariant", but the program allows it to be
changed. Your code does NOT say that any of those variables is invariant.
The problem is NOT with the cast (although that is a totally different
issue). The problem is that the code says "invariant" but the data gets
changed anyhow. The method of changing the data is not the issue. The issue
is that is gets changed at all.

When you cast something to immutable, you can no longer change it. It's a one-way ticket.

Reply via email to