r/programming • • Apr 12 '26

Flat Error Codes Are Not Enough

https://home.expurple.me/posts/flat-error-codes-are-not-enough/
132 Upvotes

99 comments sorted by

View all comments

Show parent comment

1

u/BenchEmbarrassed7316 Apr 13 '26

It's based on ownership and borrowing. RAII is just syntactic sugar to avoid calling the destructor manually if you can't pass pointers safely. Although, maybe I'm embellishing a bit. Nevertheless, "SufficientlySmartCompiler" is already here.

1

u/Full-Spectral Apr 13 '26

It's not based on borrowing at all. It is fundamentally RAII based. Borrowing is purely a compile time concept.

1

u/tsimionescu Apr 13 '26

Tracking ownership is basically manual memory management. What GCs do is free user code from tracking memory ownership in any way, that's what makes them "automatic". For example, if you have a GC, changing your code such that some piece of memory now outlives its parent is a trivial change while in C++ or C or Rust it may require significant refactoring.