DIP69 - Implement scope for escape proof references

via Digitalmars-d digitalmars-d at puremagic.com
Sat Dec 6 04:38:23 PST 2014


On Saturday, 6 December 2014 at 04:31:48 UTC, Sebastiaan Koppe 
wrote:
> What about also adding the inverse of scope? Then scope can be 
> inferred. As in:
>
> ```
> void foo(int* p);
> void free(P)(consume P* p);


Yes, this is much better. When I suggested it, it was rejected 
because D is too concerned about breaking existing code. Which is 
a not-very-good argument since this breaking change is 
concervative (you only have to add "consume" or something similar 
when the compiler complains).

The obvious solution is to do as you suggest and in addition do 
all @safe analysis on a high level IR layer using dataflow 
through and through.

Instead D continues down the rather flimsy path of partially 
addressing these issues in the type system… which will lead to a 
more complicated and less complete solution where @safe basically 
continues to be a leaky cauldron…


More information about the Digitalmars-d mailing list