Live data from Hacker News

Was Rust Worth It?

jsoverson.medium.com

281–290 of 736 posts

Re: Was Rust Worth It?

#281
post #96

Earlier quoted context omitted.

A full 70% of security vulnerabilities are caused by memory safety issues. As professionals we need to get serious and have memory safety as a baseline requirement.

So we shouldn't use Rust at all, since Rust is not completely memory safe since it let's you disable the borrow checker. We should be serious as professionals and use safe languages like Java, JS, Python, etc. But of course there are use cases where you need memory safety guarantees and bare metal performance. In those cases, sacrificing some memory safety by using Rust is an acceptable tradeoff I think.

Don't forget safety from data races. Rust's borrow checking provides much stronger protection against those than java, go, c# etc. So we shouldn't use them either.

Re: Was Rust Worth It?

#282

Earlier quoted context omitted.

I tried for a long time for chatgpt to help me write a simple function that generated a random array and then summed along the columns. Could not do it. Pasting in an error message, made chatgpt spit out another version of the code with some other error.

Go to ChatGPT and type "write a simple function that generated a random array and then summed along the columns". Run it. If there is an error, either debug it or ask ChatGPT to take a different approach. There's something wrong if you can't get it to do this.

There's something more wrong if you need it to do this

Re: Was Rust Worth It?

#283
post #53

Do you need memory safety? Then why use Rust when you could use Java, JS, Python, etc? You can't "disable" memory safety in those languages. Do you need bare metal performance? Then why use Rust when you could use C or C++, which have much larger ecosystems, platform support, more mature tooling, etc. Do you need BOTH memory safety and baremetal performance at the same time? Then there really aren't many other option…

If you're remotely sane, you'll always want memory safety. That's not really an optional property, because even in C/C++ compromising memory safety throws you straight into the land of nasal demons. The question is whether you want the compiler to ensure memory safety, or to do it completely on your own without language support. Personally, I've never met anyone who can ensure memory safety in their C/C++ without one…

And saying c++ has more mature tooling seems insane too. Anyone who has had to mess with depedency trees using git submodules and cmake, conan, bazel, vcpkg, and meson would not call the tooling, oh and hunter too!, mature.

Re: Was Rust Worth It?

#284
post #226

Earlier quoted context omitted.

100% agree. It's unbelievable what a PITA it is dealing with pip or npm compared to Maven even 10 years ago. The descriptors could get convoluted but you could also edit them in an IDE that knew the expected tokens to make things happen.

What’s so hard about “npm install” and “package.json”. It’s dead simple

No you see Java devs have stockholm-syndromed themselves into believe that a giant stack of XML, or some unhinged mini-language are actually good, and much better than something the humans involved can actually read and parse easily and now to compensate with other ecosystems providing 85% of the functionality, with 5% of the pain, they’ve got to find some reason to complain about them.

Re: Was Rust Worth It?

#285

Earlier quoted context omitted.

I'm pretty shocked by the grandparent, but on reflection, I think this is the future. In The Grapes of Wrath , Steinbeck writes about the travails of a family's trip to California in search of work during the Great Depression in the 1930s. Tom Joad, the father, fixes the compression in his blown engine by wrapping a copper wire around the cylinder, then running the motor until it melts and recreates the seal. It's su…

Copper melts at over 1000C that seems questionable.

Might have been bronze or tin—I read the book a long time ago! That said, burning gasoline or kerosine can be over 2000°C[0].

[0] https://en.wikipedia.org/wiki/Adiabatic_flame_temperature

Re: Was Rust Worth It?

#286
post #231

I wrote a lot of rust, but after some years it still feels unproductive. I do a lot of zig now and I am like 10 times more productive with it. I can just concentrate on what I want to code and I never have to wonder what tool or what library to use. I know rust gives memory safety and how important that is, but the ergonomic is really bad. Every time I write some rust I feel limited. I always have to search libraries…

> but the ergonomic is really bad. Every time I write some rust I feel limited.

> But I do not think it is a good general purpose language.

Remember that this is not a sentiment that's shared by everyone. I use Rust for tasks that need anything more complicated than a shell script. Even my window manager is controlled from a Rust program. I say this as someone who has been programming in Python for nearly two decades now. At this point, I'm about as fast in Rust as I am in Python.

Re: Was Rust Worth It?

#287

Earlier quoted context omitted.

On the supposed "monoculture": First, I have to wonder whether any of this can be legitimately elevated to the level of a "culture." Right now, according to GitHub "insights," tokio-rs has approximately 2.0 regular, every day contributors. And that's the most widely used Rust async runtime. Everything else is likely even more thin. Second, Tokio has a lot of share because it was early and aggressive in actually deliv…

Yes I think we agree, though I'd quibble about the async syntax; I use it but I have philosophical concerns about it. But I do think tokio is on the whole well implemented. But it is not a good thing for a single runtime to dominate the language like that. I've at least thought-experimented with what it would take to write my own code agnostic enough that it could run on both e.g. tokio and e.g. monoio etc. and, well…

I can't argue too much on your view of the syntax. I employ the weasel word "fine" because my experience with it is that I have little to no trouble understanding and using async Rust syntax: I can read and write async Rust and conceptually grasp what is likely going on in the runtime. I have to allow that perhaps it isn't sufficient, and maybe even that this is a factor in the runtime problem.

But there are other, non-syntax issues, such as synchronization primitives, IO events, etc. that are clearly underspecified. No maybes about it.

Re: Was Rust Worth It?

#288
post #231

I wrote a lot of rust, but after some years it still feels unproductive. I do a lot of zig now and I am like 10 times more productive with it. I can just concentrate on what I want to code and I never have to wonder what tool or what library to use. I know rust gives memory safety and how important that is, but the ergonomic is really bad. Every time I write some rust I feel limited. I always have to search libraries…

> it can be very hard to actually know what method you can call on a struct

The rust-analyzer language server can autocomplete the available methods for a value.

Re: Was Rust Worth It?

#289

Earlier quoted context omitted.

In what way? Rust (cargo technically) might have the best support for offline compilation of any language I use. `cargo vendor` does pretty much everything I want it to.

Also you can download documentation for offline using `cargo doc` so you can easily lookup stuff during a flight. Although you do need to figure out all your dependencies ahead of time so that you download their documentation before you leave.

Just FYI, `cargo doc` doesn't download the documentation. It re-generates the documentation from source. You only need the source code to generate documentation.

Re: Was Rust Worth It?

#290
post #190

Earlier quoted context omitted.

There is surely something wonderful about the kind of C++ programmer who figures that, since their unusable broken garbage compiled it's probably correct. Remember unlike most languages you'd be familiar with C++ has IFNDR, which has been jokingly referred to as "False positives for the question: Is this a C++ program?". A conforming C++ compiler is forbidden from telling you in some† unknown number of cases that it…

Can you give an example of non-C++ code that a modern compiler (MSVC, clang, g++ or something) successfully compiles with no diagnostics? I’m genuinely curious. If not, this just sounds like more C++ FUD because the spec doesn’t define everything under the sun and allows a certain amount of leeway to compilers for things like emitting different error diagnostics.

Consider:

  #define _FOO
  int main() {}
Per the C++ standard ([lex.name]/3), this program is ill-formed:

> In addition, some identifiers appearing as a token or preprocessing-token are reserved for use by C++ implementations and shall not be used otherwise; no diagnostic is required. [...] Each identifier that contains a double underscore __ or begins with an underscore followed by an uppercase letter is reserved to the implementation for any use.

Thus, the compiler theoretically has the liberty to emit whatever it wants for this program.

Neither GCC nor Clang produces a warning under -std=c++20 -Wall -Wextra (Clang only produces a -Wreserved-macro-identifier under -Weverything), and MSVC doesn't produce a warning under /std:c++20 /Wall.

In practice, most examples of ill-formed programs where compilers issue no warnings occur with discrepancies between different source files that are linked together; e.g., declaring a function as inline in one file but non-inline in another, or declaring a function with two different sets of default arguments in different files, or defining the same non-inline variable or function in different files, or defining the same inline function differently in different files.

Post reply on HN