D and Nim
Daniel Murphy via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jan 4 22:31:38 PST 2015
"weaselcat" wrote in message news:nopttywdkgouyxnlrwcf at forum.dlang.org...
> I'm inclined to believe there's some benefit to explicitly using immutable
> as Walter has written about it more than once, and it's in D's own
> documentation.
> While I'm sure the compiler can infer immutability, it probably becomes
> more difficult as the lifetime of the objects become more complicated...
> but I'm in no position to make a statement about it, maybe Walter or
> Andrei could chime in.
You're exactly right, the compiler can sometimes tell a variable is never
modified, but will have serious trouble when it comes to class members,
indirections, global/tls variables, etc.
More information about the Digitalmars-d
mailing list