Thanks for elaborating! I totally agree there's valid reasons to drop libc, though not sure if that's the right way.
In most modern languages today you can just return a tuple, not needing to mess with TLS.. whereas old times didn't really like passing results in out parameters (by ref) (which makes sense, it's less ergonomic).
Re:Hooking Go from Rust
by throwaway894345 on Friday August 26, 2022 @02:08PM
(#32610828)
I much prefer the ergonomics of passing out-parameters than TLS. Honestly, TLS has always struck me as a code smell in any language.
It was quite weird before we wrote concurrent software. Once you're writing concurrent software it's very weird because as originally documented this single error location is shared by all threads, so it necessarily gets concurrently modified while being read, a Data Race.
Your 2022 C library typically defines it as Thread Local instead, so when you call some_c_function() and then check errno, you aren't confused by the fact meanwhile another thread tried to open("nonexistent.file") and so their thread set errno to report that the file doesn't exist.
Given that none of this fuss is how the actual system calls work, it's understandable that people might want to sidestep it.