Re: DIP Proposal: @manualScoped to prevent automatic field destruction

2018-07-27 Thread FeepingCreature via Digitalmars-d
Update: https://github.com/dlang/dmd/pull/5830 Turns out unions with fields with destructors is **define behavior**. I did not know this. Probably the spec needs updating. So that pretty much alleviates the need for this DIP. Though I kind of half-believe that this DIP is actually *better*

Re: DIP Proposal: @manualScoped to prevent automatic field destruction

2018-07-27 Thread FeepingCreature via Digitalmars-d
On Friday, 27 July 2018 at 11:44:10 UTC, aliak wrote: A) I'd suggest "@nodestruct" instead, since it sounds like that what it's supposed to do? Yes-ish, but it's also supposed to fill the hole in the typesystem created by T.init, and "you can only assign T.init to types marked @nodestruct"

Re: DIP Proposal: @manualScoped to prevent automatic field destruction

2018-07-27 Thread aliak via Digitalmars-d
On Friday, 27 July 2018 at 09:30:00 UTC, FeepingCreature wrote: A new UDA is introduced: @manualScoped. It is valid for fields in structs and classes, as well as variables and parameters. Fields marked with @manualScoped are not automatically destructed on scope end. For instance, a function

DIP Proposal: @manualScoped to prevent automatic field destruction

2018-07-27 Thread FeepingCreature via Digitalmars-d
A new UDA is introduced: @manualScoped. It is valid for fields in structs and classes, as well as variables and parameters. Fields marked with @manualScoped are not automatically destructed on scope end. For instance, a function taking a struct as a @manualScoped value will lead to a copy