[Issue 9665] Structure constant members can not be initialized if have opAssign

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 9 17:42:14 PST 2013


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



--- Comment #9 from Andrei Alexandrescu <andrei at erdani.com> 2013-03-09 17:42:11 PST ---
This is an insufficiency in D's design. I think we should approach this the
same way as super() invocation and construction of qualified objects:

1. When a constructor is entered, the object is in a "raw" state.

2. While in this raw state, the object is not considered initialized so it
can't be passed to functions etc. Its const/immutable members (be they by their
own qualifier or propagated from the object) are also raw and can't be passed
out.

3. This raw state lasts until super() has been called EXACTLY ONCE and each
qualified field has been assigned to EXACTLY ONCE.

4. At that point the object has become "cooked" and all restrictions are
lifted.

Kenji, I recall we discussed this design in the context of const and immutable
constructors, and you were favorable to it. How about we extend the same design
for initializing qualified members in all contexts?

We can reuse the same primitive flow analysis that's now used for super().

-- 
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