Post #1971056
2026-05-04 10:45 UTC
@zeenix @pid_eins You could argue that representing open files as simple integer file descriptors, since all the kernel syscalls produce well defined errors.
But there are obvious benefits in wrapping the descriptor in a type that extends Rust's lifetime and memory access restrictions to those descriptors. If all code is using that abstraction, you don't have to worry about file descriptor reuse bugs, or other threads accidentally manipulating your descriptor.
Is it that outlandish to want similar lifetime guarantees for files themselves?
And the usual reason for wanting this kind of thing in the standard library is that if the default way to access files avoids race conditions, then third party code built on top is more likely to do the same.
Replies (1)
-
@zeenix@toot.cat 2026-05-04 10:48
@jamesh @pid_eins I think there's a misunderstanding here. I'm not disagreeing with what you're saying here. I think we can all agree that ranting on mastodon about it, is unlikely to do any good. I've yet to see any issues and RFCs regarding this.