Live data from Hacker News

Was Rust Worth It?

jsoverson.medium.com

461–470 of 736 posts

Re: Was Rust Worth It?

#461
post #358

Earlier quoted context omitted.

> Extensive name squatting, to the point that virtual no library uses the obvious name, because someone else got to it first. Maybe the obvious names should have been pre banned. But I don't see the issue with non-obvious names either way you're going to have to get community recommendation/popularity to determine if brandonq/xml is better or worse then parsers/xml

In ASP.NET land, I regularly work on projects where there is an informal rule that only Microsoft-published packages can be used, unless there's good reason. You don't want to be using Ivan Vladimir's OAUTH package to sign in to Microsoft Entra ID. That probably has an FSB backdoor ready to activate. Why use that, when there's an equivalent Microsoft package? When any random Chinese, Russian, or Israeli national can…

fwiw but when I saw a 3rd party library pretty much exactly like "microsoftauth" on nuget, I reported it and it was swiftly removed.

I think we need to encourage a culture that package managers are our shared garden and we must all help in the weeding.

Re: Was Rust Worth It?

#462
post #258

Earlier quoted context omitted.

As a counter example, I love programming in Rust. Fighting the borrow checker ended a long time ago. Even the errors are rare these days, except in cases I trigger them in order to examine the types. Rust compiler also seems to have improved in accepting broader cases that are valid. For me, the key to understanding the borrow checker was understanding the underlying memory model. Rust memory model is the same as tha…

How do you do anything dynamic/cyclic? Like, graphs that need to be updated in runtime?

My experience is that most programs dealing with ordinary problems don't need such complicated data structures. In cases you do, Rust has a few options:

1. Use Rust's runtime safety checks, using Rc, Weak, RefCell, etc. It will be as ergonomic as GC'ed languages (no productivity loss). While this has a runtime performance penalty, it will still be mostly comparable to other languages. This works for most use cases.

2. If you need the last ounce of performance, just drop all automated safety checks and do it manually using unsafe. Even if you make a mistake, your debugging will be limited to the unsafe blocks. This approach isn't unusual in Rust.

3. Use either the standard library or something on crates.io that does what's given in 2. Rust's generics make it easy.

This resource deals with these topics in-depth: https://rust-unofficial.github.io/too-many-lists/

Re: Was Rust Worth It?

#463
post #316
post #286

Earlier quoted context omitted.

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

I tried to get into rust for many years, I'm now in a C/CPP job (after Java/Python/Ruby and other gigs). What I've come to understand is that Rust's lifetime model is very difficult to work with whenever you have a cyclic reference. In C/CPP the same holds, but you deal with it through clever coding - or ignoring the problem and cleaning up memory later. Java, and other GC'd languages just work for these structures.…

> While the Rust devs believe such cyclic references are rare -

They are.

I have not had to use cyclic references ever, except once doing experiments with fully connected graphs, that was very unusual

If you're doing a lot cyclic references Rust is not the right choice. Horses for courses

But are you sure you're using the best algorithm?

Re: Was Rust Worth It?

#464

I never programmed in Rust, but I had enough experience in C programming to know that segmentation faults are annoying to debug. I heard Rust prevents memory management problems at compilation level, so it forces you to create safer program. Given this, I want to ask Rust programmers here: For people who have no experience in managing memory at coding stage (basically programmer who have no experience in C-like langu…

I’m not sure. Looking through different Rust libraries, I tend to see three different styles, depending on previous programming experience. Each mimics the prior experience, with benefits. * Everything is a struct with concrete types. This is closest to C. It benefits from the improved memory safety, without sacrificing speed. * Everything is a Box >. This is closest to dynamic garbage-collected languages, but with v…

> Everything is a Box>. This is closest to dynamic garbage-collected languages, but with vastly improved performance.

Why the `Box`?

Re: Was Rust Worth It?

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

This. I have exactly the same experience, I can't believe how much I was able to ship with Zig and the code mostly feels like "done". You can always improve it, but there's no need to. With Rust, I was never happy, even after 5 years, I was still thinking about better abstractions and implementing more traits, making it more generic, etc.

Why is there no need to improve Zig code but there is for Rust code? You'd need the same abstractions in Zig as well, no?

Re: Was Rust Worth It?

#466
post #258

Earlier quoted context omitted.

As a counter example, I love programming in Rust. Fighting the borrow checker ended a long time ago. Even the errors are rare these days, except in cases I trigger them in order to examine the types. Rust compiler also seems to have improved in accepting broader cases that are valid. For me, the key to understanding the borrow checker was understanding the underlying memory model. Rust memory model is the same as tha…

How do you do anything dynamic/cyclic? Like, graphs that need to be updated in runtime?

Use one of the many libraries that have safe abstractions over unsafe code? I don't know why people think you need to roll your own? I guess that's just what people do in c/c++, doesn't seem very productive...

https://docs.rs/petgraph/latest/petgraph/

Re: Was Rust Worth It?

#467

"The Rust standard library is enormous." Years ago I tried compiling a rust sample program. The binary size was one thing that put me off. Today, I see the issue of large binary size has been addressed. The binary I get is sufficiently small. If this issue of ~500M standard library is fixed, e.g., if some of it is made optional not mandatory, I will give rust another try.

Rust binaries are by default nowhere close to 500MB. If they are not small enough for you, you can try https://github.com/johnthagen/min-sized-rust. By avoiding the formatting machinery and using `panic_immediate_abort` you can get about the size of C binaries.

Re: Was Rust Worth It?

#468
post #455
post #429

Earlier quoted context omitted.

It is widely better recieved in the AAA gaming developer community than Java, and that is what matters. I also like Java, but c'mon no decent algorithms being implemented in C#? That is already approaching zealotry.

I didn't say no decent algorithm in C#, but for each performance sensitive algorithm/data structure there is a C and Java implementation at the least ( in my case Roaring Bitmaps). In C# the solution is half baked or archived or abuses allocation. I think Unity has way more with C# adoption in game dev than innate C# qualities.

This is a classic case of goalpost moving. The reason why so many algorithms are written in Java especially closer to academic side is because most curriculums in comp-sci often straight up not allow using anything else except Java, Python or sometimes C++. Having C# as an alternative in these is a luxury. There are also more people using Java in general. However, this does not make it a better language at solving these tasks, nor it is any suitable for writing high performance implementations for advanced vectorized algorithms which would push hardware, which is actually what you want when you start caring about such scenarios, which C# excels at.

Re: Was Rust Worth It?

#469
post #316
post #286

Earlier quoted context omitted.

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

I tried to get into rust for many years, I'm now in a C/CPP job (after Java/Python/Ruby and other gigs). What I've come to understand is that Rust's lifetime model is very difficult to work with whenever you have a cyclic reference. In C/CPP the same holds, but you deal with it through clever coding - or ignoring the problem and cleaning up memory later. Java, and other GC'd languages just work for these structures.…

to be a bit pedantic, i assume the language you a referring to as CPP is actualy C++? cpp to me means the c (and c++) preprocessor.

Re: Was Rust Worth It?

#470

Use C++ if you want control, use Rust if you want safety. And it seems to an extent that carbon will offer most of both.

Rust offers you great control when you need it (to the same level of C++, basically. This is what it was designed for). And even the Carbon docs say that if you start from scratch prefer languages like Rust.
Post reply on HN