Phobos is now compiled with -preview=dip1000

Meta jared771 at
Fri May 17 17:25:40 UTC 2019

On Friday, 17 May 2019 at 17:05:21 UTC, ag0aep6g wrote:
> On 17.05.19 14:10, Meta wrote:
>> Your explanation was fine, but I need a good solution, other 
>> than wrapping the array assignment in @trusted.
> I see. As far as I understand DIP 1000, it's not supposed to 
> enable your use case without having to use `@trusted`.

If this is true, then I have a big problem with DIP1000. This is 
an extremely common use case (copying memory from an inner scope 
with a limited lifetime to some store in an outer scope with a 
longer or infinite lifetime).

> DIP 1000 stops at heap allocations. It just assumes infinite 
> lifetime for them.

Yes, as per the DIP.

> If you want to restrict the lifetime of a heap allocation (in 
> your case: tie it to the lifetime of a struct), you have to do 
> it manually.

I don't want to *restrict* the lifetime of a heap allocation. I 
want the compiler to recognize that the lifetime of my original 
data is the same as the processed output, and thus allow my code 
to compile.

More information about the Digitalmars-d-announce mailing list