Hacker News new | ask | show | jobs
by idlewan 4412 days ago
For every use-case you'll encounter, there is so many answers.

There is no "when you want to do X, use language Y" guide, because it would be pretty stupid. Every good programming language can be used for nearly all your programming needs.

The only thing you need to keep in mind, is where the target program should run (and the list is very small):

- should the target program run in a browser? Use Javascript or a language that compiles to it (Coffeescript, Dart, TypeScript, ...)

- should the target program run on an embedded board (very low memory footprint, very low CPU cycles available)? Use a language with manual memory management: C, C++, Nimrod, Rust, D ...

- should the target program takes the most performance out of the hardware (games, HPC, performant system library, ...)? Use a language that makes fast executables: C, C++, Nimrod, Rust, D, Go, ...

- should the target program runs on a web server? On a desktop computer? Any case that doesn't fit the previous three? Use whatever language you want or are familiar with, they all can do it, and there is no "best choice".

3 comments

In the eighties, a lot of devices with very limited memory (from 1kB to 64kB) used garbage collection of sorts (kind of heap compaction). They were called home computers. It worked just fine.

Heck, people are running embedded Java with garbage collection and all with just a few kilobytes of RAM.

Low memory does not mean you need to do manual memory management. Of course, when you add requirements for predictable memory usage, it might be a different matter. Like embedded devices that need to run for extended time periods reliably without issues.

But then again, a lot of Commodore 64 programs written in BASIC managed to do just that without issues. Running for years without hick-ups.

From your answer then we could already improve the author's introduction...

"Go is an open source programming language designed for building simple, fast, and reliable software. It's a good choice where squeezing maximum performance out of the hardware is a primary concern."

Maybe a minor point -- but it makes the book far more compelling to people who will benefit from it, while enabling those who won't to move on.

So given that your choices for high performance is:

"C, C++, Nimrod, Rust, D, Go, ..."

Is there really nothing the author could say to help choose between them?

- should the target program run on an embedded board (very low memory footprint, very low CPU cycles available)? Use a language with manual memory management: C, C++, Nimrod, Rust, D ...

Forth?