On Thursday, August 11, 2016 21:49:46 Charles Hixson via Digitalmars-d-learn wrote: > It works, it's just not the syntax that I'd prefer. And it leaves me > wondering exactly what > immutable class Msg {...} > was declaring.
All it does is make the members of the class immutable. It doesn't affect the class itself - just like you could do @safe class Msg {...} and that has no effect on the class itself - just its members. I guess that it's somewhat confusing given that some attributes affect the class itself (e.g. public or abstract), but most don't, and if they don't, they just affect the members of the class. But the type qualifiers - const, immutable, and shared - do not affect the class itself, just its members. Off the top of my head, I think that the only attributes that affect the actual class are public, protected, package, private, static, abstract, and final - and static doesn't even affect the class in all cases (e.g. it would have no affect at the top-level of a module). - Jonathan M Davis