[Issue 6114] immutable class variable not properly initialized when the constructor initializing it is non-shared

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 8 10:45:36 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6114


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com


--- Comment #2 from Steven Schveighoffer <schveiguy at yahoo.com> 2011-06-08 10:41:02 PDT ---
I agree with Jonathan, immutables should not be assignable in non-shared ctors.

The runtime works like this:

1. program startup
2. run all shared static ctors
3. run all thread-local static ctors
4. run application
   4a. on thread creation, run all thread-local static ctors
   4b. on thread destruction, run all thread-local static dtors
5. run all thread-local static dtors
6. run all shared static dtors.
7. end program

So everything is unraveled the same way it was, um... raveled :)

I think since immutable means 'store globally', it should be only assignable
from a shared ctor.  Otherwise, you run into issues.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list