I think on almost all cases, and also having a bigger community, it is a win for Rust/Go.
I think on almost all cases, and also having a bigger community, it is a win for Rust/Go.
I also love D's metaprogramming. It feels almost like lisp. Go's lack of generics doesn't allow this and Rust's macros don't feel as comfortable for me.
Yes, D is smaller but it's also big enough for me. I don't feel like I'm missing out on much when I'm using D. If I need a library to do something that isn't already in the fairly generous stdlib, I can find it on DUB.
But I appreciate how that's not necessary and I can use only system-installed libs with Meson and pkg-config :P
It is funny how Go sold it as a feature, but it was always a deficiency in D (and yes, it just happened out of the box.)
That isn't to say C dynamic libraries didn't work, that is a linker thing, but it would be the same in Go.
But boy, on the Algol-tree, it's about as far away from Go as you can, erm, go. The blog poster's predecessor was about as heavy as you can get into generics without being called Stepanov.
D tends to have quite a lot of features and lets you pick your subset, which brings it closer to languages like C++ or Scala. Go, being basically Oberon filtered through New Jersey, is a lot more minimalistic. Old Java vs. new Java, basically.
https://atilaoncode.blog/2015/02/11/the-craziest-code-i-ever...
Compared to Go: much better designed and richer language.
Obviously in terms of community, it's much smaller. But if you're ready to "build vs buy" more, or if you have some small scope project, I'd encourage you to try it.
But I can testify that spending my first days with Rust was a struggle the whole way. It's probably because D had spoiled me a lot by the time I got to Rust. After some time I lost interest as Rust didn't offer anything that I was actually missing in D, while D had much to offer in the areas of things I liked.
the meta programming is very cool also
import std.stdio;
struct Math(string Op) {
static auto eval(T, U)(T l, U r) {
static if (Op == "+")
return l + r;
else static if (Op == "-")
return l - r;
else static if (Op == "*")
return l * r;
else static if (Op == "/")
return l / r;
}
}
static immutable auto result = Math!("+").eval(1, 2) + Math!("*").eval(3.0, 3.0);
void main() {
writeln(result);
}
You'll never be able to do anything like that in Rust until const generics are not only complete on their own, but also fully compatible with "const fn". import std;
template Math(char Op) {
auto eval(T, U)(T l, U r) {
static foreach(x; "+-*/") {
if (Op == x)
mixin("return l ", x, " r;");
}
}
}
static immutable result = Math!('+').eval(1, 2) + Math!('*').eval(3.0, 3.0);
void main() {
writeln(result);
}