digitalmars.D.learn - Does immutable class memeber needed to be marked as 'static'?
- HOSOKAWA Kenchi (8/8) Aug 07 2009 I'm just migrating to shared, and I have some questions to switch static...
I'm just migrating to shared, and I have some questions to switch static variables to immutable. I'm confused about how to treat 'static immutable' class members and function local constants which is determined at compile time or 'static this'. According to "Const and Immutable" article, it seems that immutable value requires only single memory instance which is able to be referenced from anywhere, any class instance, any threads or any function in any stack. Put all of them into a ROM, yep! But wait, here is function local immutable which seems not to be in a ROM. 'static immutable' class members may have single memory instance, so that they seem not to need 'static' marking. Function local constants, on the other hand, may need to be marked as 'static immutable' or 'invariant' if we need unique value among all threads. I'm not confident about them, so please let me know how to treat them.
Aug 07 2009