D and Nim

weaselcat via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 4 21:28:28 PST 2015


On Monday, 5 January 2015 at 02:12:21 UTC, Ary Borenszweig wrote:
> For the second, the compiler can tell that if you don't assign 
> anything more to it then it's immutable. So I'm not sure the 
> second one is true.

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.

http://dlang.org/const3.html
http://www.drdobbs.com/architecture-and-design/optimizing-immutable-and-purity/228700592


More information about the Digitalmars-d mailing list