DIP69 - Implement scope for escape proof references

via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 11 01:07:43 PST 2014


On Thursday, 11 December 2014 at 00:35:46 UTC, deadalnix wrote:
> It is always safe to consider scopeness of the retrun value (if 
> marked scope) as being the intersection of the lifetime of 
> parameters.
>
> That should cover most bases, and we can still extends later if 
> this is too limited (I suspect it is ok for most cases).

Linear typing is already extremely limiting, by limiting it even 
further you end up with something annoying. You basically get a 
version of memory safety that does not solve any typical memory 
unsafe situations.

By having pointers that do scope-depth-tracking you do at least 
get a generic solution that can be optimized away when possible. 
The D authors have to accept that you need to embed ownership in 
pointers if you want memory safety and convenience, or that you 
have to provide means to guide the semantic analysis. You need 
one or the other, or both, but you cannot pretend that you can do 
without.

Arbitrary constraints are annoying, not convenient. If I as a 
programmer know that something is safe, then the compiler should 
accept it, and the language should allow me express it.


More information about the Digitalmars-d mailing list