Why are you using D instead of Rust?
nise at nise.com
Thu Dec 16 10:20:58 UTC 2021
On Saturday, 23 October 2021 at 04:25:21 UTC, Dr Machine Code
> Just would like to know you all opinions
Programming rust as a high level language only using the
primitives in the standard library, you probably will do find.
Aesthetics is not one of the strong sides of Rust in my opinion
though and when you compare codes in Rosetta you often find that
the rust implementation is longer.
When you step outside the box, then the ugliness starts to show
I was investigating the intrusive collections in Rust.
One notable file, src/adapter.rs you will see a macro
intrusive_adapter. The purpose of the macro is to expand an
entire implementation of the algorithm. I guess the author has
done this because the generic system in Rust is too limited than
using standard generics. If you abuse this macro you can in
practice create a new expanded implementation for every source
file you use it in which can lead to longer compile times and
code duplication. You'd hope that the compiler is smart enough to
remove duplicates of the same type.
One thing you notice is that the macro almost unreadable. I don't
often agree with Walter but not allowing macros in D I do agree
with. Adding macros to D would risk making the readability
With many other languages, implementing these algorithms are
often done in a few 100 lines but the Rust implementation is
huge. You also notice that general code isn't that readable
In these cases you'd think that an offsetof compiler statement in
order to find the offset of a member variable in a struct would
help. Problem is that Rust doesn't have any offsetof. Rust has
been around of over 10 years and offsetof is one of the first
things you'd implement but not in Rust. There are crates that
implements this and there you also notice how the authors has
implemented hacks to achieve this simple thing.
The more I use Rust and look under the hood, the more what the
h... revelations I get. I can see how Rust might appeals to the
C++ crowd who likes the over complicated parts in C++ and that
way gives them hubris when they circumvent the limitations of
More information about the Digitalmars-d