3 ms·
Only if you don't do it atomically. And while you can't guarantee atomic deletes, you can enforce them using the type system. Think of the following code:
by Retra 11y ago
Only if you don't do it atomically. And while you can't guarantee atomic deletes, you can enforce them using the type system.
Think of the following code:
if (n != null) {
n.do_something()
}
What happens if n gets deleted after the null check, but before the method invocation?
So you are already assuming that you can do certain things atomically, even if, in theory, some external agent can write on your data. You manage that by protecting your data (with asynchronous tools or immutability), or by statically verifying your code.