←back to thread

1087 points smartmic | 3 comments | | HN request time: 0.599s | source
Show context
PaulHoule ◴[] No.44303560[source]
Content 1, Style 0

Thinking you are too smart leads to all sorts of trouble, like using C++ and being proud of it.

If you think your intelligence is a limited resource however you'll conserve it and not waste it on tools, process and the wrong sort of design.

replies(4): >>44303999 #>>44304040 #>>44304316 #>>44305090 #
guywithahat ◴[] No.44304040[source]
It would be really embarrassing to use one of the most popular, time-tested languages.

Even if we decided to use Zig for everything, hiring for less popular languages like Zig, lua, or Rust is significantly harder. There are no developers with 20 years experience in Zig

replies(2): >>44304265 #>>44304290 #
shadowgovt ◴[] No.44304290[source]
Being at a firm where the decision to use C++ was made, the thought process went something like this:

"We're going to need to fit parts of this into very constrained architectures."

"Right, so we need a language that compiles directly to machine code with no runtime interpretation."

"Which one should we use?"

"What about Rust?"

"I know zero Rust developers."

"What about C++?"

"I know twenty C++ developers and am confident we can hire three of them tomorrow."

The calculus at the corporate level really isn't more complicated than that. And the thing about twenty C++ developers is that they're very good at using the tools to stamp the undefined behavior out of the system because they've been doing it their entire careers.

replies(4): >>44304409 #>>44304546 #>>44305200 #>>44306652 #
WD-42 ◴[] No.44305200[source]
And none of those 20 C++ developers can learn rust? What’s wrong with them?
replies(4): >>44305551 #>>44305678 #>>44306032 #>>44306250 #
1. PaulHoule ◴[] No.44305678[source]
Personally I think Rust is better thought out than C++ but that I've got better things to do than fight with the borrow checker and I appreciate that the garbage collector in Java can handle complexity so I don't have to.

I think it's still little appreciated how revolutionary garbage collection is. You don't have maven or cargo for C because you can't really smack together arbitrary C libraries together unless the libraries have an impoverished API when it comes to memory management. In general if you care about performance you would want to pass a library a buffer from the application in some cases, or you might want to pass the library custom malloc and free functions. If your API is not impoverished the library can never really know if the application is done with the buffer and the application can't know if the library is done. But the garbage collector knows!

It is painful to see Rustifarians pushing bubbles around under the rug when the real message the borrow checker is trying to tell them is that their application has a garbage-collector shaped hole in it. "RC all the things" is an answer to reuse but if you are going to do that why not just "GC all the things?" There's nothing more painful than watching people struggle with async Rust because async is all about going off the stack and onto the heap and once you do that you go from a borrowing model that is simple and correct to one that is fraught and structurally unstable -- but people are so proud of their ability to fight complexity they can't see it.

replies(2): >>44306054 #>>44307460 #
2. shadowgovt ◴[] No.44306054[source]
In our case, a garbage collector is a non-starter because it can't make enough guarantees about either constraining space or time to make the suits happy (embedded architecture with some pretty strict constraints on memory and time to execute for safety).

I do think that there are a lot of circumstances a garbage collector is the right answer where people, for whatever reason, decide they want to manage memory themselves instead.

3. rcxdude ◴[] No.44307460[source]
Usually the main message is that they haven't thought about the organisation of their datastructures sufficiently. In my experience this is also very important with a GC, but you don't get much help from the compiler, instead you wind up chasing strange issues at runtime because object lifetimes don't match what you expected (not to mention, object lifetime is more than just memory allocation, and GC languages tend to have less effective means of managing lifetimes tightly). I agree async Rust is very painful still. It's very much something I don't use unless I have to, and when I do I keep things very simple.

(Also, the lack of a package manager for C is much more due to historical cruft around build systems than it is difficulty getting C libraries to work together. Most of them can interoperate perfectly well, though there is a lot more faff with memory book-keeping)