The non-intrusive ad-hoc borrowing scheme…

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Wed Nov 13 14:47:19 UTC 2019


On Wednesday, 13 November 2019 at 14:15:10 UTC, Atila Neves wrote:
> How would this differ from actually using valgrind or address 
> sanitizer?

Good question. I haven't used this concept for anything more than 
playing with it. Off the top of my head the potential could be:

- It should work with custom allocators that reuse memory

- It could track borrowed views on an array, such as array 
slices. So you could track whether there are overlapping views 
being borrowed or if the view is unique.

- It should work for concurrency scenarios when you want to know 
if you have an isolated reference that you safely can transfer to 
another context. I.e. Pony reference types, but here it would be 
done at runtime as dynamic types.

- You could also extend it to work with multithreading, so that 
you could tell whether a resource is only available to a single 
thread.

- Hopefully give better debugging information by tracing the 
conceptual borrowing rather than memory access.

I think there are opportunities here for borrowed references that 
are stored on the heap in graph like structures(which is a 
limiting factor for Rust).



More information about the Digitalmars-d mailing list