3 ms·
I'm not sure I buy the rationale for not choosing drop() here, but then I'm not a Swift programmer. It's true that this is a bunch of magic, while Rust's drop(
by tialaramex 4y ago
I'm not sure I buy the rationale for not choosing drop() here, but then I'm not a Swift programmer.
It's true that this is a bunch of magic, while Rust's drop() is so non magical its implementation, which you could copy-paste if you wanted, is supplied in the documentation:
pub fn drop<T>(_x: T) { }
But the reason Rust programmers write drop(x) is going to be much the same as this proposal would have Swift programmers write _ = move(x) -- to explicitly tell the compiler they want to destroy x right here. So I think as a programmer the drop(x) would make sense.