DIP69 - Implement scope for escape proof references

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 8 15:00:04 PST 2014


On Saturday, 6 December 2014 at 12:38:24 UTC, Ola Fosheim Grøstad
wrote:
> 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…

This is inherently about ownership. I have a proposal about this.
Scope is about using things without ownership.

Both are linked but different beast.


More information about the Digitalmars-d mailing list