Live data from Hacker News

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

news.ycombinator.com

191–200 of 262 posts

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

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

You are nitpicking. size_t is architecture dependent, on x86 it will usually be 32-bit, on x86_64 it will be usually 64-bit. It's not equivalent to i32, u32 types.

Also, I find i32 and u32 types much cleaner than D's "unsigned int" and "int". What is the difference between "unsigned int" and "unsigned long" in D? It's still better than C++, but I'd rather write i32 and i64 rather than "int" and "long".

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

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

> this is just D's size_t

Rust has usize [0] as a size_t equivalent.

[0]: https://doc.rust-lang.org/std/primitive.usize.html

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

#193

I wouldn't compare a WIP borrow checker, just added some months ago, against Rust. However, where it's the bigger and unique thing that D haves. Fast and very powerful metaprogramming. Can do things like parsing a XML or JSON at COMPILE TIME and generate code. No body catches how powerful is this ? For example, imagine parsing a gtk-build /glade XML and generating the GUI code at compile time, instead parsing it at r…

This is really quite common thinking in D.

I was writing a library and a contributor popped out of nowhere. He didn't knew D. The first patch it suggested was about parsing some JSON at compile-time.

It turned out std.json the stdlib parser was able to parse at compile-time in CTFE context. So, the contributor parsed JSON at compile-time without his knowledge, without really knowing D, and the fact it worked was accidental (since the parser was n't specially designed to do that, but could).

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

#195
post #41

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

If that is indeed the answer (and I don’t think it is), perhaps try to answer the question “why isn’t there a similar movement for D?”

Why should you rewrite good software? D can call C libraries. With DPP you can even use C macros in D code. D has some interoperability with C++ so now you have access to some C++ libs. But wait there is more. D can interop with python and R. And there was a person that talked about C# interop.

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

#196

Earlier quoted context omitted.

Possibly nim as well. But We should be able to provide interop between llvm and gcc so they can all cross pollinate in some way? Not saying it’s easy, nor that I have the skills to do it, but we should be able to build across boundaries and stop soloing so much?

I don’t hear much about Nim. Will this language ever take off? It seems this language needs a large corporation backing it, to get a chance to succeed.

Probably, but it could also be a positive as it is not beholden to one of the major tech companies.

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

#197

Earlier quoted context omitted.

I don’t hear much about Nim. Will this language ever take off? It seems this language needs a large corporation backing it, to get a chance to succeed.

Nim's compiler was full of bugs and would crash on trivial programs for a long time. It also has garbage collection so ends up in a different niche. Just like Zig not parsing tabs or carriage returns or V being broken on windows and never fixed, I don't think it is corporate sponsorship that is the problem, but more basic utility. Plenty of people are trying these new languages, the demand is there, but there is usua…

Yeah I didn’t know about the bugs.. still, the idea / design is good. Hopefully they get it sorted out

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

#198

Earlier quoted context omitted.

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

> 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 seem to feel much more "comfortable" manually writing all the knobs by hand than trusting a more algorithmic GC's shiny chrome knobs on the outside of (what they presume to be) a black box.

But perceived "comfort" isn't entirely reality. (The comfort of smart GC languages is immense in a different way.)

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

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

Sure, but that's nothing a few years in the real world can't fix. The point is that C++ programmers are not some rare breed of neckbeard that are gradually going extinct. They are being produced en mass.

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

#200
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 got scared away by rust's syntax. I feel that people can learn rust faster if they know c++ beforehand. c++'s syntax is scary too. But there are different levels of c++. You don't need to use the scary part to make things work.

No, knowing C++ probably confuses you for a while, it has confused me.
Post reply on HN