cannot cast

Chris Cain clcain at uncg.edu
Thu May 3 02:00:07 PDT 2012


On Thursday, 3 May 2012 at 08:54:48 UTC, Namespace wrote:
> I thought that const = "cannot change directly" and immutable 
> stands for "cannot change all the time". If not, why exist both 
> storage classes beside?

const = you (as in, your view of the data as you're working with 
it) can't change
immutable = no one can change it ... as in, there exists no view 
of the data that can mutate it.

It's a subtle distinction. In fact, you can be handed a "const" 
and it's actually immutable underneath. And since immutable data 
can actually be stored in read only memory...


More information about the Digitalmars-d-learn mailing list