Skip to main content
8 events
when toggle format what by license comment
Aug 10, 2015 at 10:58 audit First posts
Aug 10, 2015 at 10:58
Jul 21, 2015 at 18:44 comment added David Arno @kdbanman, you may prefer my other answer then (assuming you are able to upgrade to VS2015)
Jul 21, 2015 at 18:14 comment added kdbanman Interesting term, I had to google it - poka-yoke is a Japanese term that means "mistake-proofing". You're right! That's exactly what I'm doing.
Jul 21, 2015 at 18:09 comment added David Arno @kdbanman, and your point is? If your class only writes to the private setters during construction, then it has implemented "real immutability". The readonly keyword is just a poka-yoke, ie it guards against the class breaking the immutablity in future; it isn't needed to achieve immutability though.
Jul 21, 2015 at 18:01 comment added kdbanman My actual class is a bit more complex that the MWE I gave. I'm after real immutability, complete with thread safety and class-internal guarantees.
Jul 21, 2015 at 17:48 comment added David Arno The class described is immutable, as it doesn't change itself.
Jul 21, 2015 at 17:47 comment added kdbanman "public int Foo { get; private set; }" That class is no longer immutable because it can change itself. Thanks, though!
Jul 21, 2015 at 17:43 history answered David Arno CC BY-SA 3.0