On Saturday, 17 August 2024 at 19:05:22 UTC, Renato wrote:
> On Sunday, 4 August 2024 at 20:14:50 UTC, Renato wrote:
I wrote this also in Dart and Common Lisp as I was curious how D would compare to them.
Dart can parse libphobos.a in 1.3 seconds, and Common Lisp in around 1.5.
With D, it took only 0.4 seconds! And the code is actually the easiest to read IMHO.
A win for D :)
Congrats! Which D compiler & flags did you use to test this BTW?
> I might later convert D to use the exact same approach as in the other languages, just for curiosity... and I think that should be pretty easy, and if it is, it will prove to me that D really is a flexible language that makes it "easy" to modify code... will see.
D is generally pretty good for refactoring in my experience; except when you need to swap a class with a struct, which is when it gets a bit messy.
> I already know Rust and I just don't feel like using it for anything (it's a combination of hard to write and modify code, ridiculous slow compile times even for small projects, but specially when using libs, which you need to for even the most basic stuff like proper error reporting etc....).
I tried to learn Rust myself, and it certainly didn’t inspire me to keep coming back for more.
I could see that a lot of Rust’s design patterns were clearly from the wish-lists of some long-time sufferers of C, but there were clearly a few lessons they never learned. For one, that snake_case
and ::
are just awful, genuinely so awful that their prevalence in Rust was very concerning to me. And for two, most programmers don’t want to have only one retained mutable reference at once; in fact many design patterns are completely impossible that way.
Before it was too late, I realised that Rust is where happiness goes to die, which didn’t make me feel like my prospects with it were very great. You don’t want to spend 10 years honing your skills in a language that makes you miserable, after all. So I gave up and kept searching back then, and here I am now.
> Anyway, in the unlikely case someone is curious about what code looks like in these 3 languages:
D: https://github.com/renatoathaydes/dar/blob/main/source/dar.d
Dart and Common Lisp: https://gist.github.com/renatoathaydes/54a93e91cacfafd08ad875f11615fbc2
The Dart code looks less awful than I was expecting given its… progenitor. Shamefully, I cannot read Lisp for the life of me, despite being infatuated with the language’s design pattern, so I can’t comment on that one.