5 ms·
From one of the linked pages: "Lack of garbage collection was a problem but runtimes are more troublesome...Linux signal handling becomes very complicated...Ru
by jeff-davis 5y ago
From one of the linked pages:
"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.md#lack-of-garbage-collection-was-a-problem-but-runtimes-are-more-troublesome 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.
- v8dev123 5y agoAlso, "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!!!
- jeff-davis 5y ago"Whenever you port a big program to another language it is important to be conservative, in my view." 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.
- ibraheemdev 5y agoNote that implementing Deref/DerefMut to mimic OOP is considered a bad practice. They were originally meant solely for smart pointer types, although some have opinions™ about that. Either way, you may need to reshape the way you think about program design coming from OOP languages - I know you've probably heard that before, but its true :) There are usually better options. Learning from FP pattern helps, as Rust leans more towards FP than OO in my opinion, although it has elements of both. Separating data and implementation (behavior) at the syntax level is one instance of that design decision showing through, no inheritance is another.
- v8dev123 5y agoAre you talking to me or the author? 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.
- ibraheemdev 5y agoAh, sorry, I didn't realize they were quotes from the post. (You generally put quotes in quotation marks or blockquotes "> ..." to distinguish). I guess the advice applies to anyone struggling with rust coming from an OOP background :)
- mhh__ 5y ago> 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 https://discord.gg/bMZk9Q4) is also where you can find a bunch of other D employees (Mainly me at the moment), maintainers, users etc.