logoalt Hacker News

Panzerschrektoday at 5:39 AM2 repliesview on HN

> Rust: Drop runs automatically at scope end, so this specific bug simply doesn’t exist.

That's why having no auto-destructors is a dead-end. This is the greatest mistake of such languages like Zig or Odin.


Replies

delamontoday at 8:37 AM

They don't play nicely with arena allocators. And arenas is what you reach for if you have clear lifetime bounds: e.g. a single request with arena never de-allocates individual objects, nukes arena when done. That gives you an easy verifiable protection against leaks, data (and cache) locality and deallocation that cost zero cpu cycles.

show 2 replies
dnauticstoday at 6:14 AM

You can statically analyze for leaks.

show 1 reply