by teleforce · 1y ago · 0 comments
D language smiling in the corner [1].
"D supports Ownership and Borrowing, just like Rust. DMD, D's reference compiler, can compile itself in less than 5 seconds, thanks to a fast frontend and fast backend. D is easy to metaprogram through traits and templates. You can make your own JIT in D with dynamicCompile." [2]
[1] Kevin James meme creator tries to guess why the photo went so viral:
https://www.yahoo.com/lifestyle/kevin-james-became-internets...
[2] Ask HN: Why do you use Rust, when D is available?
There are appropriate ways to contrast D with Rust and illustrate where D is stronger, but it is inaccurate to say "Rust has borrowing; D has borrowing" and conclude that they are comparable in this sense.
Indeed, there are languages that have generics, compile blazingly fast, and still have good runtime performance. Go lang is another good example, although not perfect too. If only Rust designers did a single thing to make it compile fast instead of "eventually".
I'm sorry, but I sensirely think the Rust designer did a sloppy work by reimplementing C++ flaws with a new syntax. The history repeats itself, the same pathological mechanism once driving C++ development now drived Rust — I mean large enterprise wanting to change everything without changing nothing, the new tool that would feel like the old tool. They did not really invent some new model, look at std::shared_ptr, std::mutex, move semantic — it was already in C++ before the prototype of Rust. The "share immutables, lock mutables" model was a holy grail of C++ concurrency caused by the way STL worked — and STL is not nearly the only container library in C++.
Okay, what's your take on why exactly Rust compiles slowly?
> Okay, what's your take on why exactly Rust compiles slowly?
It's not "my take". https://www.pingcap.com/blog/rust-compilation-model-calamity... is a good resource on this.
* Windows support is mediocre due to decades of not supporting it at all.
* OPAM is a nightmare. Surprisingly buggy and extremely confusing. We're not talking Pip levels of badness but it's nowhere near as good as Rust, Zig or Go's equivalents.
* A silly obsession with linked lists. Ok I understand why but it's still annoying.
* Ocamlfmt thinks it is writing an essay, and generally makes things less readable IMO.
* The syntax is not easy to read. They threw away all the useful punctuation that help you visually parse code.
* Tiny community.
* Very spartan documentation. Examples are very rare.
* Global type inference is definitely worse than Rust's local approach because it makes errors much worse, and makes the code harder to understand.
* Native int type is 63 bits.
I haven't even done much OCaml but it's definitely got enough issues that I strongly prefer Rust. Just the community size is reason enough really.
That said, it's still way better than Python, Ruby, PHP, Java, JavaScript and Perl. Those are kind of the Z-tier languages though so I guess that's not saying much.
If it was a choice between OCaml and Go, Swift, C#, Dart... then it wouldn't be a slam dunk either way. Unless you wanted Windows support and then OCaml is a crazy choice.