by jeff-davis · 5y ago · 0 comments
"Lack of garbage collection was a problem but runtimes are more troublesome...Linux signal handling becomes very complicated...Runtimes also often force layout of data structures be tuned to the needs of the garbage collector..."
https://github.com/sidkshatriya/me/blob/master/002-why-rust....
That sums up my experience using a lot of higher-level languages. The pitch is always that language X should replace C because it's just as fast in most practical cases but much easier and safer. But the reason I use C is because of the pain of complex runtimes, especially when interoperating with other languages.
And that's also why I'm interested in Rust. It's the first high-level language (I use the term loosely) that doesn't interfere with anything you're trying to do. It can even do dynamic dispatch on ordinary pointers to structures with a C memory layout, because it doesn't add a vtable pointer to structs (like C++ does).
"I don't know much about dlang -- it could have been the best of both worlds"
Yeah, I skipped over dlang, too. And I don't have a good reason for that, aside from a lack of time to really explore both. I hope dlang keeps growing and eventually I'll look into what it has to offer.
If you decide to have a look at what we have to offer, feel free to join our forums. The following discord server (https://discord.gg/bMZk9Q4) is also where you can find a bunch of other D employees (Mainly me at the moment), maintainers, users etc.
"Lack of Object-Orientation was a concern"
Whenever you port a big program to another language it is important to be conservative, in my view. You don't want to make so many structural changes in the way things work in the original codebase while porting things over. You risk things becoming very confusing and the port could fail. In future iterations you could definitely make things more idiomatic in the target language.
As far as Rust is concerned, it does not have traditional OO features. But by using the Deref/DerefMut trait specifically and traits in general I was able to recover and mimic a lot of OO behaviors present in rr in rd.
The rd code may not always be beautiful.
FYI,
Rust had a GC also Classes in it's initial versions but they were removed for some reason!!!
These sentences direct copy paste from Author post, but I agree that Rust leans more towards to FP. The creator labeled Rust as Linear FP language.
Either be very conservative or just tear things up. I think the middle ground is the worst, where you can't decide whether it's a rewrite or a port.