Immutability and other attributes, please review

Roman D. Boiko rb at d-coding.com
Thu Jun 14 06:53:45 PDT 2012


On Thursday, 14 June 2012 at 13:33:43 UTC, Roman D. Boiko wrote:
> On Thursday, 14 June 2012 at 13:31:01 UTC, Roman D. Boiko wrote:
>> On Thursday, 14 June 2012 at 13:21:34 UTC, Jacob Carlborg 
>> wrote:
>>> If you want that and have it immutable you need to make a 
>>> deep copy of the passed in object to be safe. You could use 
>>> const instead and also making the argument const. If an 
>>> argument is const you can pass both mutable and immutable 
>>> values, and const of course.
>> Thanks, I'll try that.
> But then I will have problems sharing such data structures with 
> different threads, correct?
Convenience of usage would be less important than compiler 
guarantees, so it looks like I have to stick to immutable, not 
const.


More information about the Digitalmars-d-learn mailing list