const?? When and why? This is ugly!

Walter Bright newshound1 at digitalmars.com
Sun Mar 8 17:24:09 PDT 2009


Derek Parnell wrote:
> I know that a better way to code this example would have been to use the
> .idup functionality, but that is not the point. I relied on the compiler
> ensuring that everything declared as immutable would not be modified. The
> compiler failed.

It is the same issue. When you use a cast, you are *explicitly* 
defeating the language's type checking ability. It means that the onus 
is on the one doing the cast to get it right.



More information about the Digitalmars-d mailing list