Remix.run Logo
tialaramex 3 days ago

To be clear: Rust does not have linear types. Rust has affine types. An affine Goose can't destroyed more than once. However zero isn't more than one. A linear Goose must be destroyed exactly once. Austral would be an example of a language with linear types.

In C++ if we destroy this Goose twice, probably everything catches on fire, whoops.

In Rust or Austral if we attempt to destroy this Goose twice the code doesn't compile. No executable for you until you stop destroying the Goose twice.

In C++ or Rust if we forget to destroy the Goose, the Goose-destroying code never runs. Hope that wasn't important.

In Austral if we forget to destroy the Goose, the code doesn't compile. No executable for you until you ensure the Goose is destroyed.