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

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sun May 29 08:18:54 UTC 2022


On Sunday, 29 May 2022 at 08:03:57 UTC, rikki cattermole wrote:
>
> On 29/05/2022 7:42 PM, Ola Fosheim Grøstad wrote:
>> Simple stuff like a queue of size two? How do you know what it 
>> contains?
>
> See above

You will end up being too pessimistic. For instance: if the queue 
is empty you will assume it is tainted by eveything that went 
through it...

To get to a good place you have to do a good overapproximation.

> I too would like to have proper reference counting on structs 
> and classes with optimizations, but the compiler has to know 
> what object to do the reference counting on! Right now things 
> can escape reference counting.

Impose more limits on @safe. Then give @trusted and @system 
wrappers and other constructs that allows them to give @safe code 
what it needs.

A fat pointer can track ownership when you address fields. Then 
get rid of fat pointers by optimization.



More information about the Digitalmars-d mailing list