3 ms·
How is it so that we see some applications that languages like Rust (and C/C++) seem to be tailored for, but more and more cases pop up that the author have cho
by ducktective 6y ago
How is it so that we see some applications that languages like Rust (and C/C++) seem to be tailored for, but more and more cases pop up that the author have chosen Go?
Is it a quality vs speed of dev thing? Or am I just wrong in assuming anything system-related should be written in C/C++/Rust?
- coldtea 6y agoThe author choses whatever they're familiar with and likes, and Rust has a larger barrier to learn, so less people use it than Go. Not some huge mystery... >Or am I just wrong in assuming anything system-related should be written in C/C++/Rust? For one, Go has a GC, so memory safety wise it should be as safe as Rust. Second "systems" is too broad a term to be very meaningful. There are excellent systems programs (databases, search engines, etc) written in Java for example...
- erik_seaberg 6y agoGo makes everything mutable with no synchronization, so concurrent slice appends can be lost and map reads and writes can panic. Rust makes you decide which reference is mutable, which takes work but it’s important for the same reasons as static typing.
- hnlmorg 6y agoWhile that's true, it's also true that just because the reference is mutable it doesn't mean the developer is stupid enough to pass mutable references between threads without mutexes to prevent the aforementioned race conditions from happening in the first place. Plus Go also has channels which are a thread safe way of message passing. I'm not taking anything away from Rust but a great many of us have been writing multithreaded code for years before languages like Rust made it safe. These aren't new problem I had to solve. But I'm also not complacent about the risks of multithreaded code and in fact murex's test suite does check for race conditions.
- hnlmorg 6y agoAuthor here: murex pre-dates Rust 1.0 and by the time Rust was stable there was already considerable code committed to murex. I have toyed with the idea of rewriting in Rust but every time I weigh up the pros and cons it becomes obvious the rewrite is just an academic exercise rather than a worthwhile venture (why rewrite something that already works?) The advantage of Go over C++ is that you get memory safety and cross compilation out of the box. Plus Go is a much faster language (for me -- YMMV) to prototype in; which matters when I have a day job and two young kids :D