Live data from Hacker News

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

news.ycombinator.com

221–230 of 262 posts

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

#221
post #45

Earlier quoted context omitted.

A language is more than just a technology: it's an ecosystem of libraries, platform APIs, developer mindshare and experience, familiarity, legacy codebases, product support. Don't discount the weight of all of those auxiliary, human factors. Rust, culturally, comes from the web. That's why it has the most traction in the web server/WASM space for now. It's starting to poke its head into Systems use-cases because of t…

Not really. While there is a growing set of web-based application for Rust, it's not like PHP, where the very purpose of the language is the web. Rust is a system language before it is a web language. WASM as a target is actually a great indication that it's a system language -- performance is a primary consideration.

Everyone is targeting WASM nowadays.

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

#222
post #175

Earlier quoted context omitted.

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 ca…

> Subjectively, I see no point in having "val", "var", "let", "def", "fn" symbols which bring only noise to code.

Usually, the reason is to make parsing easier. C++ is infamous for having undecidable grammar. Ruby is extremely pleasing to the eye, but its grammar is a clusterfuck. Newer languages have learned from that, so they try to have simpler grammars.

Another reason for those small syntax markers is to avoid implicit language decisions. In Rust, having to write one of "let/let mut/const" means forcing the programmer to make an explicit choice regarding mutability and memory usage. In Scala, "val/lazy val/var/lazy var/def" means having to think about mutability and evaluation times.

> What about Rust unable to drop parenthesis after a function?

In the case of Rust, the reason is uniformity. Even Scala, of all languages, is walking back on the optional parentheses, because the language allows to define functions with multiple argument lists, and optional parentheses introduce ambiguity between functions with empty argument lists and functions with no argument lists.

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

#223
post #81

Earlier quoted context omitted.

C++ was a dying language in the 2000s. But they turned it around with C++11. Now it has iterative 3 yearly updates and it's getting pretty good. It's far too premature to declare its death. The pace of development of C++ is decently fast and there's many stakeholders with millions of lines of C++ who are interested in C++ not dying. C++ is taught in universities around the world so the chance of C++ developers becomi…

The C++ they teach in universities is either just C, or putting Java spin on C (C-with-classes). I've never seen a decent "modern C++" class taught in universities.

I love that Java spin on C remark, given that stuff like Turbo Vision, MFC, OWL, PowerPlant, Motif++, CORBA, COM, VCL, SOM, CSet++, POET precede Java for several years, some almost a decade.

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

#224
post #46

Earlier quoted context omitted.

Google and Pike get you in the door. Goroutines get you to sit down. The onboarding-oriented nature of the language and ecosystem convince you to sign.

What Go did for the tooling space cannot be underestimated, it is wonderful and we will never go back to the before time.

What providing a formatter like indent has provided for decades?

Selling a Turbo Pascal/Modula-2 like compilation speed from MS-DOS days as novelty?

Or was using IDE code refactoring tools as UNIX CLI?

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

#225
post #152

Earlier quoted context omitted.

> It's only a game developer of all people, Jonathan Blow, that's doing it and his creation is a C++ replacement for games, not general purpose software. Sigh. That would still be huge. C++ keeps being used because of games. There's little to no C++ software being written nowadays that's not games. And games are a gigantic industry, bigger than the film and music industries combined. Many game developers would love t…

> There's little to no C++ software being written nowadays that's not games. You need to look around more, because you are totally wrong on this point. It's true that C++ isn't used a lot in web programming, and web programming is what a lot of people see these days. But there is a lot more software being written than web programming and games, and C++ is still in fairly significant use.

On Web, desktop, mobile and distributed computing space, which are the areas I am focused on, C++ is indeed still used, however no longer for full stack applications like it used to be 20 years ago.

Rather we get to write the applications in some managed language, and C++ only gets used for some performance critical libraries, or GPGPU programming.

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

#226
post #87

Because there's a movement called "Rewrite everything in Rust"

There will always be a movement "rewrite everything in x". This seems to be a natural manifestation of the generation conflict. Looking at the history of programming languages, it is certainly not wrong to say that any "most loved" language has a good chance to become the most hated language at some point in the future. And so on and so forth.

This is why I dislike using guest languages, instead of using existing "native" libraries for the platform, there is always that additional layer of idiomatic libraries for the guest language, yet another layer to debug and try to map to the original feature set.

And naturally their own build tool, debugging representations and IDE plugins.

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

#227

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 implementation of algebraic type is in the library. https://dlang.org/phobos/std_variant.html#.Algebraic

I have not utilized tagged unions outside this type so I'm not one to comment on any deficiency.

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

#228
post #220

Earlier quoted context omitted.

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 w…

You can do this with a build script.

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

#229
post #220

Earlier quoted context omitted.

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 w…

You can do this with a build script.

So goodbye declarative builds.

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

#230
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..

Well learning D or Rust likely will not help you get a job writing Javascript. My C# style is heavily influenced by D, for the better IMO.

I have some potential coming up to do some Typescript, it will be interesting to find out how to transfer my experience into this language.

Post reply on HN