Thread overview
immutable storage class?
Mar 06, 2009
Sergey Kovrov
Mar 06, 2009
bearophile
Mar 06, 2009
Sergey Kovrov
Mar 12, 2009
Robert Fraser
Mar 07, 2009
Stewart Gordon
Mar 07, 2009
Jesse Phillips
March 06, 2009
I cannot find any information about immutable keyword. I presume it is a storage class and should be described in "Declarations" manual page, but it is not. On the other hand it is mentioned in changelog and some manual pages. Is it an alias for invariant or const, or something completely different?

-- serg.
March 06, 2009
Sergey Kovrov:

>Is it an alias for invariant or const, or something completely different?<

I think it's the new (correct) name for invariant.

Bye,
bearophile
March 06, 2009
From playing with compiler looks like immutable and invariant are practically interchangeable. And typeof reports that invariant is really immutable. I personally like immutable keyword better, but wonder if it is just a change of name or something more?

-- serg.
March 07, 2009
Sergey Kovrov wrote:
> I cannot find any information about immutable keyword.
<snip>

http://d.puremagic.com/issues/show_bug.cgi?id=2572

Stewart.
March 07, 2009
On Fri, 06 Mar 2009 08:58:04 -0500, Sergey Kovrov wrote:

> I cannot find any information about immutable keyword. I presume it is a storage class and should be described in "Declarations" manual page, but it is not. On the other hand it is mentioned in changelog and some manual pages. Is it an alias for invariant or const, or something completely different?
> 
> -- serg.

I'm not sure what is the real reason for it's existence, but it seems many people prefer the term immutable over invariant. So I guessed that Walter is planning on changing the name to immutable. He might keep both in there, but I really don't think that is a good idea.
March 12, 2009
Sergey Kovrov wrote:
> From playing with compiler looks like immutable and invariant are practically interchangeable. And typeof reports that invariant is really immutable. I personally like immutable keyword better, but wonder if it is just a change of name or something more?
> 
> -- serg.

From the newsgroup discussions, it's just a change of name, with the exception that only invariant can be used for class invariants:

class Foo {
    invariant() { }
}