Caterpillar

Daily Thought - 2024-07-11

< back to list

Speaking of Rust, why do we need this business with linear types anyway? Why not just have something like Drop, which is Rust's implementation of destructors?

Destructors can work in many cases, but what if the destructor needs to do something that returns an error? Where would that go? What if the destructor needs to call an operation that's async? Those are real problems in Rust.

But it's not a problem with linear types. The compiler forces you to do something with a value. But what you do, where you do it, what resources you use to do it; that's up to you.

<< previous thoughtnext thought >>