A few languages out there provide immutability by default. I'm on board with D not providing it by default, but would it be useful or worth the effort to add an @immutable attribute to first class citizens and namespaces eg

// All members & fn returns immutable by default in each case
@immutable module my.ns;
@immutable class foo { .. }
@immutable struct bar { .. }

Additionally,

module blah;
@const import std.algorithm; // All return refs/vals & public members from std.algorithm treated as immutable within blah

I hesitated to post this since I haven't done much with D, so I hope I'm not insulting anyone (I have great respect for you all - you were very helpful when I was trying to learn the language). No idea how hard this is. Thoughts?

Reply via email to