[nem-en] closure in ctor, this in ctor

Dmitry Ivankov divanorama at gmail.com
Mon Mar 26 22:50:26 CEST 2007


I'm working on field init & base/other ctor calls.
And field init will happen before base ctor call.
But when closure utilizing "this" is created we require that ctor starts
with "base(..)", it'll be too strict if there are field-inits (we generate
unnecessary error in that case).

So, will it be okay to move "_N_closure._N__N_closurised_this_ptr999 = this"
exactly after base/other ctor call wherever it is?

And a more general question: how is the status of "this" changed in
ctor/what are restrictions on it?
Before base ctor call:
- can't access base
- can assign own fields some values
- (?) can use already assigned values via "this.field1"
- (?) can use default-initialized fields (null, 0, ...)
- can't use "this", except in "this.not_base_field"
After base ctor call:
- treat "this" as fully constructed object, i.e. use "this" in any way
And the most tricky, during the base call:
a) while computing params to base ctor (maybe important if we want to pass
"this" to base ctor)
- same as before base ctor
b) in base ctor (important if base ctor calls virtual method)
- (?) become fully constructed exactly when base is fully constructed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman/pipermail/devel-en/attachments/20070326/3b3871f3/attachment.html


More information about the devel-en mailing list