News for hackers. Stuff that matters.
Re:Deciding to rewrite getaddrinfo in rust by MichaelBurge on Tuesday February 23, 2016 @11:34AM (#11160056)
I know that it's used for more than just C programs, but it still seems a little perverse to rewrite the C standard library in something other than C. Imagine if someone had a preference for writing his Python libraries in Perl that emitted Python bytecode. Or if C++'s Boost was the output of a Haskell program.
Re:Deciding to rewrite getaddrinfo in rust by Santosh83 on Tuesday February 23, 2016 @11:40AM (#11160105)
I get what you mean, but I guess calling it the "C Standard Library" is really a historical holdover from times when the entire system was written only in C (with the exception of a smattering of assembly). In the current context it should probably be called the "System Standard Library" and when you consider it like that, a system standard library in another language isn't all that weird. They all compile down to machine code anyway, so the Python-Perl analogy doesn't quite match.
Re:Deciding to rewrite getaddrinfo in rust by pjmlp on Tuesday February 23, 2016 @11:55AM (#11160269)
UNIX is the C runtime, kid of.

They just didn't want to force it into other OSes when ANSI C was defined and eventually POSIX took up that role.

Re:Deciding to rewrite getaddrinfo in rust by _yosefk on Tuesday February 23, 2016 @11:56AM (#11160282)
Actually many people have a preference for writing their Python libraries in C :-) Python was explicitly designed under the assumption that much of the heavy lifting will happen in C. And C programmers write their parsers in Yacc, etc.

(This is not to say that rewriting libc is a good way for people knowing Rust to spend their time. It's a ton of effort with the result most likely to be unused and if it is used, then it provides a small benefit to C and C++ programs at the expense of a rather scarce resource - Rust developers - having been diverted from benefiting Rust programs. If I were a Rust enthusiast, I'd much rather write libraries in Rust designed to be used in Rust programs so that more such programs get written more quickly than use Rust to put lipstick on the pigs that are C and C++.)

Re:Deciding to rewrite getaddrinfo in rust by nickpsecurity on Tuesday February 23, 2016 @12:25PM (#11160517)
It seemed perverse to me to write our desktops and servers in C given how it was "designed:"

http://pastebin.com/UAQaWuWG

Once one understands it, getting rid of as much of it as possible makes a lot more sense. The replacement should ideally stand alone eventually, have stronger memory/type/integration safety, not assume what calls it (eg C code) will do things right, and integrate with C easily. Not sure how much Rust fits that as I lack details.

Result would've eliminated all kinds of crashes and host compromises due to C-specific errors. It is ironic that one of the best ways for a C application to be safe while using 3rd party code is avoiding C in that 3rd party code. :)

Re:Deciding to rewrite getaddrinfo in rust by dalailambda on Tuesday February 23, 2016 @12:10PM (#11160395)
On the other hand, how many languages use libraries that are written in C? Especially in the higher level scripting language ecosystems(JS, Python, Lua) a lot of libraries interface with C/C++ libraries. If instead they used Rust, would that not result in a gain for those languages(even if there was a small C wrapper around it)?
Re:Deciding to rewrite getaddrinfo in rust by carussell on Tuesday February 23, 2016 @02:34PM (#11161624)
What about a C compiler written with C++?

If it helps any, `getaddrinfo` is actually part of POSIX and not an essential part of C.