[DIP] In-place struct initialization
ZombineDev via Digitalmars-d
digitalmars-d at puremagic.com
Thu Aug 4 23:12:24 PDT 2016
On Thursday, 4 August 2016 at 08:23:59 UTC, ketmar wrote:
> On Thursday, 4 August 2016 at 07:22:27 UTC, ZombineDev wrote:
>> On Thursday, 4 August 2016 at 05:15:56 UTC, Patrick Schluter
>> wrote:
>>> This said, in C++ compound initialiser are implemented in
>>> some compiler as extension and are really problematic (object
>>> life time) and it would be probably similar in D
>>
>> I would be interested to hear more about that. My (maybe
>> naive) understanding tells me that there shouldn't be any
>> problems:
>
> there are: inline structure declaration is broken, see issue
> 16146. therefore it is clear that inline decl is using
> compeletely different codepath, not connected with calling
> struct ctor, and may be called "compiler extension" too.
>
> sorry, i couldn't resist injecting one of my pet bugs here.
Thanks, for the bug report. It's important that it gets fixed if
we're to proceed with this proposal.
I was actually looking for design issues. Assuming this bug gets
fixed, and
S s = { a: var1, b: var2 }, becomes equivalent to:
S s = void;
s.a = var1; /* calls s.a postblit if necessary */
s.b = var2; /* calls s.b postblit if necessary */
Are there any *design* problems that I did not foresee, that make
my proposal not worthwhile pursuing?
More information about the Digitalmars-d
mailing list