Live data from Hacker News

Ask HN: Why do you use Rust, when D is available?

news.ycombinator.com

211–220 of 262 posts

Re: Ask HN: Why do you use Rust, when D is available?

#211
post #204

Given the choice, I would rather use D, because experience has taught me that tracing GC are a productivy boom, even in systems programming, also D provides all the necessary tooling for doing GC free programming when required to do so. However it lacks the commitment of a proper roadmap and big corporate support, and that sadly damages its image. Rust on the other hand, while quite relevant for bringing affine types…

Is there much choice though in terms of jobs? I mean, is it worth learning D vs rust? I'm actually thinking about that nowadays, for what to learn next..

Re: Ask HN: Why do you use Rust, when D is available?

#212
post #69

I remember how about 5 years ago I researched what new language to take on. I was in an unusual position to not consider job availability since I planned for a long game and was primary interested in growing my basic coding skills. It narrowed down to D, Go, Nim and Rust. Rust won on paper based on C-like performance without GC and being not OOP-oriented in a Java way (I tried Java earlier and wondered who in his rig…

> Go [...] there was not much I saw the language could teach me Interesting that you mention this; one of the reasons I really enjoy Rust is because of how it forces me to think through things more clearly, and how a number of the higher-quality crates teach more advanced approaches in a straightforward way.

I am a Python programmer first and foremost (data science-y stuff), but lately I've started reading the Rust documentation. First and foremost its really an enjoyable read. I also learn alot from it, and become a better programmer in general. I will try to write a library that I will use for my PhD, in Rust. I think it will teach me a lot about programming, be enjoyable and also give me a great library for string parsing and decryption.

Re: Ask HN: Why do you use Rust, when D is available?

#213
post #204

Given the choice, I would rather use D, because experience has taught me that tracing GC are a productivy boom, even in systems programming, also D provides all the necessary tooling for doing GC free programming when required to do so. However it lacks the commitment of a proper roadmap and big corporate support, and that sadly damages its image. Rust on the other hand, while quite relevant for bringing affine types…

Is there much choice though in terms of jobs? I mean, is it worth learning D vs rust? I'm actually thinking about that nowadays, for what to learn next..

In terms of jobs I guess Rust has the edge, including all major ones in desktop, server and mobile OSes, there are still some companies using D though.

https://dlang.org/orgs-using-d.html

So if getting a job is your major learning motivation, then I guess Rust has definitely the edge there.

Re: Ask HN: Why do you use Rust, when D is available?

#214
post #28

Personally, at some point Rust was just clearly better and after a while - I lost interest in D. I don't have time to keep track of D catching up, when I'm so happy with Rust, and ecosystem is growing so fast. Maybe D got much better in last few years... but I kind of don't care anymore. It's hard enough to introduce a raising star like Rust to your coworkers and D just don't have traction anymore. I've been followin…

I’m currently trying to get into robotics. But why does everyone want c++? Surely robots can be programmed in other languages.

The problem is that whIle C++ has problems, all languages have problems and C++ has the most going for it in terms of being fast and easy to write.

C++11 is a really good language. Also there are tons of libraries and things people have already built in it that you can leverage to reduce development time.

Re: Ask HN: Why do you use Rust, when D is available?

#215

Earlier quoted context omitted.

> But why does everyone want c++? Few "want" C++, but for robotics a non garbage-collected language is necessary so latency is predictable. There are few mature languages besides C/C++ in that category. Rust is an improvement, but I'm hopeful something like Julia (Julia Robotics, https://juliarobotics.org/ ) or Scala Native ( https://scala-native.readthedocs.io/en/v0.3.9-docs/ ) becomes mainstream, the productivity g…

Garbage-collected languages can have (and some have had) latency-predictable GCs. It's not entirely an either/or, it's something of a false dichotomy. "Non-garbage collecting" languages blur the line anyway because even basic things like reference-counting are still a garbage collection technique. The trade-offs are in how many control knobs and where those knobs are/how you turn them, and a lot of developers still s…

Something of a false dichotomy - perhaps. The fact is that allocating at all during realtime operation is frowned upon. Given that the best approach is pre-allocation and then turning off the GC, why carry the overhead of the GC at all?

For 99% of realtime work, the Rust or Scala Native approach is just fine. No GC required. Julia users can just use the pre-allocation approach.

The important thing is avoiding language patterns that encourage needless allocation.

Re: Ask HN: Why do you use Rust, when D is available?

#216
post #182

Earlier quoted context omitted.

Also D has a gcc backend. Which is nice but it's still missing some of Rust's features.

Its more than that. D is part of GCC - The GNU Compiler Collection. Meaning that if you use linux and have recent GCC you already have D compiler.

Don't know anyone that uses the D GCC compiler, it is still playing catch up. The frequency of new D releases with intended and unintended breaking changes, usually source only ever compiles for a very narrow range of versions of D. What people usually focus on is the latest, unless there is a new bug that prevents them from using the newest version.

Re: Ask HN: Why do you use Rust, when D is available?

#217
post #59

As far as I know, D does not have ADTs (algebraic data types, a.k.a. tagged unions, a.k.a. Rust enums). I see that it has "enums" and "unions", but neither of these appear to be ADTs if I'm reading them correctly. And Rust's borrow checker can give very strong guarantees that aren't present in any other mainstream language that I'm aware of. In Rust, you can pass mutable references to large data structures between th…

D's borrow checker is only semi-documented/WIP at the moment. https://dlang.org/blog/2019/07/15/ownership-and-borrowing-in... Basically D just needs that big break to actually get things done. There are some absolutely brilliant people working on D but there's only so much sweat people will donate (some people are paid but I imagine rust probably has upwards of a hundred full time staff given that Mozilla and Microso…

Yes it is very much still a WIP, what is currently implemented, how it is implemented and the fact it is already in the compiler (without a switch) is rather disappointing. Unless the implementation drastically changes, the outlook for the feature is not good at all.

Re: Ask HN: Why do you use Rust, when D is available?

#218
post #174

Earlier quoted context omitted.

Why are they impossible in Rust? Are you aware of Rust's macros right?

Rust macros know nothing about types, but types are what do all the work at compile time.

Do they have to know about types?

Re: Ask HN: Why do you use Rust, when D is available?

#219

Earlier quoted context omitted.

The reason behind putting the type after the variable is that the resulting syntax plays way better with type inference. Scala is a clear inspiration for Rust in that regard.

(Let me nip a little here). Looks like not only Scala inference types but also its compile times too migrated into Rust.

Hahaha, it's true that Rust compile times are slower than its main competitors, due to the amount of work the compiler does. It's the same with Scala: even if some abstractions in both languages are zero- or low-cost during runtime, they still slow down compile times.

In any case, as a Scala dev, I wish the compile times were as short as in Rust!

Re: Ask HN: Why do you use Rust, when D is available?

#220

Earlier quoted context omitted.

Rust is much better at caching the intermediate results of compilation. First time compilation might take some time, recompilation will be faster though.

cargo doesn't do a terribly good job of caching dependencies. Might be better than whatever C++ does though.

Currently C++ is still a better experience, because using binary dependencies is quite common, so you don't compile the whole world, rather just your own application.

Then most organizations have staging areas where you can share binaries across the company.

And the two package managers that have been growing community support, conan and vcpkg, support caching and distribution of binary dependencies.

No doubt cargo will eventually get something similar, it just isn't there today.

Post reply on HN