Live data from Hacker News

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

news.ycombinator.com

181–190 of 262 posts

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

#181
post #25

Phobos/Tango. GC, then optional-GC. Compiler support for various platforms was wonky, never sure if I was using the right one. D as of now is a worthy competitor to Rust, it wasn't always the case, it was more like Go, with the GC. I hit some snags and moved on and didn't go back. I am sticking with Rust. I think a question with closer alignment is, "Why use Go when D is available" ? D feels like a 5x better Go, not…

Why did go took off then?

Go used one of the oldest sales tricks since day one. You sell all your shortcomings as merits. My imagination for fun:

* We don't have templates. Hm. Let's bad mouth them. Let's say templates are too difficult. Agreed.

* We don't have exceptions. Hm. Let's bad mouth them as well. Agreed. That one is easy.

* We don't have much abstractions. Hm. Let's convince new college graduates that they can't handle abstractions anyway. Mwahaha. But waait! New college graduates are actually smarter than us. I know... But we will convince them that they are not. Mwahaha.

There is more but I think I've just earned enough down votes with that much already. :)

But there is one sales sentence I will never forget. Go people said "No major systems language has emerged in over a decade"[1] As a person who was very much into D at that time (and I still am), and as a person who knows how "major" D is, that sentence from the Go people make me see them as either ignorant of the programming language scene or deceitful. Cheap sales tactic at best...

Disclaimer: I used Go professionally for 1 year for a product in the microservices space in 2017-2018. The only thing Go had going for it was the libraries that were already written at least for that space. Whatever we needed was already written for us; we had to wait at most 2 weeks for something that we needed to pop up. There was nothing else in the language that made me want to write in Go.

[1] https://web.archive.org/web/20091114043443/http://golang.org...

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

#182
post #59

Earlier quoted context omitted.

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…

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.

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

#183
post #175

Earlier quoted context omitted.

One of the reasons why I haven't approached Rust is its syntax. Subjectively ugly and polluted with punctuation symbols that tell you little about their semantics. D looks cleaner and more readable even for a person not familiar with the language. D's readability is on par with scripting languages. Rust is far away from that. Type names after variable or before? When you think about declaring a variable, do you think…

For reading code, which arguably should happen more often than writing code, having the variable name first makes it easier to find, since it's right near the beginning of the line and it's a single word. If the type comes first, I have to scan the line to figure out where the type ends and the variable name begins. Also, having "let" at the beginning of the line makes it immediately clear that it's a variable defini…

Subjectively, I see no point in having "val", "var", "let", "def", "fn" symbols which bring only noise to code. Why would you want to explicitly tell that something is a value while all you need to do is write its type and name?

double[] arr;

bam! Simple and clear.

What about functions? It has input, name and output and D nicely presents you with

double[] createArray(int size) {...}

This is as little typing as you can get while keeping readability.

And here is a basic Rust function

fn add_one(x: i32) -> i32 {...}

What kind of type is i32 btw? oh, there is u32 as well. integer 32bit and unsigned 32bit? What on earth are these? Ah, this is just D's size_t, the same size_t as in C/C++. So that C/C++ ppl have zero overhead reading D code and for Rust they will google. To top that, you have also -> because of the type after the definition scheme. Needless verbosity, same thing in Scala.

What about Rust unable to drop parenthesis after a function?

self.host_addr.clone()

Should I mention Rust's UFCS?

But I am nitpicking, right. This doesn't make a language bad in any way. However, as I said, Rust readability is pretty subpar in addition to already steep language learning curve.

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

#184
post #57
post #55

Earlier quoted context omitted.

> Normal people don't want to touch C++ anymore. Only people that think that CVEs are "just fault of bad developers" (LOL) can still be considering C++ a good language to start new projects in. Deliberately inflammatory, and also false. 1. Rust has limited abstraction features to make it more approachable and implementable, but make it unable to express libraries that are easy in C++. This will not change soon, altho…

1. Could you give a few examples of libraries that can’t be made in Rust due to lack of abstraction compared to C++? GUI libraries apart, I can’t think of anything offhand. 2. True, but growth curves are rarely linear. Here’s a rough proxy on users - the number of subscribers to /r/rust - https://subredditstats.com/r/Rust . Look at the growth between 2014-18 and 2018-2020. You’re extrapolating on current growth rate,…

I am under the impression that Rust is lacking even the most basic level of dependent typing: being able to template over a value; pretty much every typesafe buffer library I have ever written uses this to make Random() return not just "a buffer" but "a buffer of size 32", which makes doing parsing of various packet formats and combining sources of information a lot more reasonable. (I am also under the impression that the Rust people intend to fix this lacking, but until then I know I am going to feel a bit crippled.)

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

#185
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…

Are you saying AAA-game/kernel/embedded developers are not normal? Pretty uncalled for if you ask me.

Depends on how you define normal. :D I offended a lot of C++ fans, I guess.

I guess what I meant is "vast-majority of devs out there".

I did ~10 years of kernel/embedded myself. Generally people use C++ only when they really have to (like: they work in one of this niches, or want to get a job there). I've experienced myself many times when people would go with anything but C++ because of all it's faults, weaknesses and general infamy. And I also have seen some people that gave Rust a try and it went smoothly. They deliver a proper C++-level performance and resource control, without any of the problems and were happy about the experience.

AAA-game/kernel/embedded are all lucrative (except games, lol), important and not tiny but they are still niche.

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

#186
post #184
post #57

Earlier quoted context omitted.

1. Could you give a few examples of libraries that can’t be made in Rust due to lack of abstraction compared to C++? GUI libraries apart, I can’t think of anything offhand. 2. True, but growth curves are rarely linear. Here’s a rough proxy on users - the number of subscribers to /r/rust - https://subredditstats.com/r/Rust . Look at the growth between 2014-18 and 2018-2020. You’re extrapolating on current growth rate,…

I am under the impression that Rust is lacking even the most basic level of dependent typing: being able to template over a value; pretty much every typesafe buffer library I have ever written uses this to make Random () return not just "a buffer" but "a buffer of size 32", which makes doing parsing of various packet formats and combining sources of information a lot more reasonable. (I am also under the impression t…

The basics are in nightly, but yes, not yet. We’ll get there.

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

#187
Disclaimer: I've used D for an enormous time, and I tried Rust for about one hour for the experience.

Remarks:

- build times are worse in Rust, but not _that_ much worse

- with Rust error messages are plentiful and helpful to solve the error. It is a designed user experience, which is quite novel.

- the first Rust program I built downloaded no less than 146 packages, which seems to indicate the standard library is very barebones. This was an example program. So the granularity of package seems to be smaller there. I don't really like this.

- Rust has quite visibly a stronger open-source ecosystem, with lots of crates being built before a compiler release. Good.

- Rust documentation is more aimed at beginner programmers, and there is more of it.

- I just don't like to look at Rust code at all... the styling on the car is really bad

- it seems dub and cargo are very similar. Cargo download and installs a lot more cruft inside directories. Probably there is a way to have a shared directory for that.

- Rust libraries look a bit more systematically modular with the features tags ("configurations" in DUB parlance)

- it seems Rust has comparatively more C bindings than C-to-D translations in the ecosystem (vs D)

So... I'm not sure I would take Rust if starting a codebase today. It just doesn't add up for me versus D.

I try to be someone practical and need actual measurable improvements in the daily practice.

For me the key take-away is the very consistent experience when interfacing with Rust tools, since this experience has been designed and fine-tuned to be easy. I think D can learn some UX tricks from it.

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

#188
post #139

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…

For some reason Python seems to be very popular in academic robotics right now. Not a great choice

> Not a great choice

It is a great choice to prototype the ideas

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

#189
As a D user who never used Rust, few reasons why Rust is more popular than D:

- better ecosystem, cargo has many more packages, almost every important C library has a binding available, also many C++ libraries like Qt, Bullet. D claims to have the best C++ interop capabilities of all languages, but it's not reflected in the amount of bindings to C++ libraries available

- Rust has a better foundation in form of standard library and "blessed" packages. D standard library hasn't had many updates over the years. There are packages such as std.xml that are due for replacement, but no replacement exists. There is still no standard http package, serialization package.

- adding to the above - many problems in D are solved by the way of "I made something, maybe someone will find it useful". Pieces of code are shared, but there is no organized effort to fill in the gaps, and in the effort there is, there often seems to be lack of the final push to get something included in the standard library. There has been many potential stdlib packages in form of pull requests that never get merged due to codestyle nitpicking or some design concerns, with authors never moving in to fix it.

- more IDE-friendly environment. A lot of D code is constructed in build-time, which isn't friendly towards refactoring and code completion tools. Also, many people in D community are hostile towards IDEs, considering them as bloat and that "real programmers use Vim/Emacs and don't need those fancy syntax highlighting".

- stretching the language too thin. D started as a mostly GC language. Now we have @nogc and betterC. But neither really work as well as going full GC. Now ownership and borrowing system is coming into play soon. Automatic refcounting might be implemented in the future. That's a lot of possible failure points, and ecosystem splitting points.

- Lisp curse. There aren't many syntax sugars added into the language, and many language features can be somewhat implemented with templates. Things like named arguments can be implemented as a template hack, but it looks terrible both from caller and callee side. But for many people it's "good enough" and they consider the case closed and move on to other features. As a result, D offers often many half-baked solutions. Libraries that worked for someone but never really got fully implemented, language features that somewhat work as long as you don't use that other feature that they don't work with. etc.

Obviously many of those problems in D are just a matter of lack of manpower and lack of money, it's a bit of chicken and egg problem.

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

#190
post #150
post #129

Earlier quoted context omitted.

You're missing the point. The point is that Rust came from Mozilla . Its mind-share started with web people and is expanding from there. What I'm trying to get across is that those social forces can matter more for adoption than just the tech's appropriateness, considered in a vacuum.

In that case, it came from Mozilla for working on a web browser , with primary goals of security, building sandboxes & language runtimes (js), and replacing an application-level cross-platform C++ core. Which is very different than "web people", which in my mind implies webdev -- html/css/js + API server/db/caching backend. Which also further explains why WASM is so far along (sandbox, security), much better than any…

Off course it's a system language, there are even some that try to build an OS in Rust

https://www.redox-os.org/

Post reply on HN