Idea: Ownership & lifetime escape analysis by variables in reference to

Walter Bright newshound2 at digitalmars.com
Sun May 29 20:26:21 UTC 2022


On 5/28/2022 5:22 PM, Rikki Cattermole wrote:
> 1. Inferred for anything non-virtual

dip1000 infers `scope` and `return` for:

1. templates
2. lambdas
3. nested functions
4. generated functions

i.e. where the source to the function is there.

But this isn't so for:

   int* foo(int*);

where the declaration of foo() is separated (maybe in another file) from its 
definition.

Your proposal requires all the source to be available, and no "header" 
declarations. It also won't work for pointers to functions and delegates.

To make those work will require annotations - the same reason D has `scope` and 
`return` annotations.


More information about the Digitalmars-d mailing list