Well, this topic certainly took an odd turn. Owell...
On Feb 3, 2022, at 18:23, Adam Thornton
<athornton(a)gmail.com> wrote:
It feels like the tide has turned from Go to Rust. ...
The incursions of Rust (and not Go) into Linux, Mozilla, and such may indicate a trend.
Although a bit outdated, I stand by what I wrote about
Go several (six?) years ago:
https://athornton.github.io/go-it-mostly-doesnt-suck
I quite enjoyed this and found it to be informative, as well. My personal reaction to Go
(mostly derived from skimming Brian's book) is that (a) it's well tuned to
Google's needs and (b) not well tuned to mine. Specifically...
Google needs a language which runs efficiently and links in a reasonable amount of time,
even when HUGE sets of libraries are involved. It also needs a convenient way to do
massive concurrency. Finally, it needs zillions of programmers to be fungible, dropping
into code bases that they've never seen before, without tripping over landmines. My
impression is that Go meets these criteria admirably. But, horses for courses...
I program mostly on my own, so most of these criteria are irrelevant to my needs. I use
Ruby for short scripts and Elixir for larger programs. Neither one is blazingly fast, but
they both feel comfortable to write in. I like Matz's taste in design and think that
José Valim has pulled together a very appealing mix of concepts and syntax from Clojure,
Erlang, F#, Lisp, Ruby, etc.
One problem I have with Go is that it doesn't match the way I code. Kind of like (I
imagine) an oil painter might work, I start with broad swatches and fill in the details
over time. So, any new program is likely to have stubs lying about, waiting to be
implemented. Also, I might well calculate a variable only to support a trace statement
which is currently commented out. Go is very intolerant of this sort of thing: an unused
variable, IIRC, is a fatal error. Google isn't paying me to put up with this sort of
thing, so I don't.
Another problem I have with Go is the concurrency model. First, it uses threads, which
I've never felt competent to use safely. Shared mutable state is one of those things
that seem to me like an accident waiting to happen. Also, though I have no real
experience with CSP, it seems like the Actor model may be better suited to exploratory
programming.
Getting back to Rust, my impression is that its design assumes that having the computer
put up guard rails will (mostly) keep programmers from making catastrophic mistakes. In
contrast, the Erlang (and thus Elixir) approach assumes that things WILL crash and that
the important thing is to make sure that the system as a whole keeps running smoothly.
So, for example, it provides supervision trees which can handle any crash of an Actor,
etc.
Also, I learned pretty early in my career (ca. 1972) that some of the biggest botches come
from folks not understanding the needs of the users. I wrote a 10 KLOC PDP-11 assembly
language program, based on a 1" thick specification document. It never got used,
because it didn't solve the users' problem. Fine code, broken spec...
Having said all this, I'm actually quite happy about the fact that Rust is creeping
into Linux. The coding style is likely to be a bit more careful and it may well help to
provide some protection against security issues. (ducks)
-r