3 ms·
I guess that's what the 'copy count' is for. After 'recycle x', the copy-count for the reference 'x' would be 0, so it's invalid to use. That would be trivial
by flohofwoe 3y ago
I guess that's what the 'copy count' is for. After 'recycle x', the copy-count for the reference 'x' would be 0, so it's invalid to use.
That would be trivial to do as a runtime check, don't know if the compiler is smart enough to catch such things at compile time.
Also not sure if the idea of a 'copy count' is better than a 'generation counter' which also provides runtime protection against dangling access, e.g. see https://floooh.github.io/2018/06/17/handles-vs-pointers.html https://floooh.github.io/2018/06/17/handles-vs-pointers.html