Casting away immutability

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 1 19:07:38 PDT 2015


On Wednesday, 2 September 2015 at 02:05:00 UTC, Sergei Degtiarev 
wrote:
> I can't understand how cast coexist with immutability.


Cast bypasses immutability, triggering implementation-defined 
behavior. You might modify immutable data, you might cause the 
program to crash, it might just not do anything, depending on 
exactly what is going on in the implementation.

When you use cast, you basically take matters into your own hands.



More information about the Digitalmars-d-learn mailing list