Live data from Hacker News

Was Rust Worth It?

jsoverson.medium.com

401–410 of 736 posts

Re: Was Rust Worth It?

#401
post #347

Earlier quoted context omitted.

What's a frequently encountered case for such cyclic loops? Without details I'm drawn to trying to break the cycle, either by promoting the shared state to a container object for the set, or by breaking it out into it's own object that multiple things can point at.

a parent field. a doubly linked list

Doubly-linked list is something you have almost no reason to ever write.

Parent field is something where you have a clear hierarchy (it's not really “cyclic”, so it's the perfect use-case for weak references).

When coming from a managed-memory language, this obviously requires some conceptual effort to understand why this is a problem at all and how to deal with it, but when compared to C or C++, the situation is much better in Rust.

Re: Was Rust Worth It?

#402

Earlier quoted context omitted.

80% of crates have no unsafe code in them.

So only 1/5 of Rust code is unsafe? Isn't safety, like, the point of the language?

No, 1/5 of Rust code contains unsafe directly. Also, "the" point (in the area of safe/unsafe) is to manage unsafety and provide safe abstractions from unsafe foundations. If you go deep enough there's always something which will be unsafe (the type system would have to able to proof the whole universe otherwise), but most programmers will not have to write such code themselves (no, most of use do not write double-linked lists each day) - they can just use it (e.g. by using the standard library). And if they have to write unsafe code the unsafe parts are restricted to certain areas of their code. Areas they can then invest extra time and care to make certain their assumptions hold true.

Re: Was Rust Worth It?

#403

Programming in Rust is really not like being in an abusive relationship. The compiler is trying to help out as much as possible, especially since rustc has the best error messages in the world.

The OSes want programmers to handle resources correctly, and the Rust compiler makes that task a breeze. We are in a more abusive relationship with our OSes, than the Rust compiler. How about the hardware? Doesn't that need to run assembly in a correct way? That counts as an abusive relationship as well. Rust's error messages are one of a kind. There no other compiler which comes even close. As a side note, i used la…

Rustc is so good I learnt a lot about the language by just reading errors.

Re: Was Rust Worth It?

#404

> I am a massive proponent of test-driven development. I got used to testing in languages like Java and JavaScript. I started writing tests in Rust as I would in any other language but found that I was writing tests couldn’t fail. Once you get to the point where your tests can run – that is, where your Rust code compiles – Rust has accounted for so many errors that many common test cases become irrelevant. I wonder w…

When writing in loosely typed languages, some folks aim for 100% line coverage, to make it more feasible to refactor down the line. Which then of course ends up being a lot of tests for fairly basic stuff that the type system could help you with...

Re: Was Rust Worth It?

#405
post #311
post #297

Earlier quoted context omitted.

ChatGPT has helped me survive learning Rust.

That's the opposite of my experience. The Rust book helped a lot and going to chatGPT for additional questions usually ended up with bad answers.

People should specify which version of GPT they are using.

Re: Was Rust Worth It?

#406
post #157

I feel like Rust finally broke the idea that programmers should be in complete control and completely conscious of everything the compiler is doing. It hasn't been that way in decades, compilers are freaking magic. But Rust undid a lot of that with borrowing. People became comfortable with the compiler knowing better than them. I just wish we could relax further: We should never be explicitly iterating forward over a…

> Give me rusty bash. Bash with types (especially floats), fewer edge cases, functions with explicit parameters, simple command line flags...

Check out nushell, the Rust of the shells.

I know it’s still not 1.0. Then just get fish. At least would save some keystrokes.

Re: Was Rust Worth It?

#407

Earlier quoted context omitted.

C# is underrated by the HN crowd, I find. I quite like how mid sized firms (100-1000 employees) use it.

Is it? Every time I see C# being mentioned here people agree how awesome it is. Not that I'm complaining, I love C#

Agreed. I feel C# is appropriately rated on HN and other programming forums. It has perfomant memory options that other GC languages lack, and great builtin packages to use. Overall, it is a good language.

My biggest issue with C# though is how badly exceptions are handled given that it is a statically typed langauge. I wish functions explicitly defined the exceptions it can throw since a minor package bump could add an exception without your compiler warning you that it isn't handled. I much prefer Rust, Go and Zig's error handling to C#'s since those kind of issues don't happen.

Re: Was Rust Worth It?

#408

Earlier quoted context omitted.

It’s pretty much the same issue all languages have, that async functions are colored. I don’t think it is unique to rust. Algebraic effects would solve this, but I don’t know any language other than OCaml that is working on that approach.

It’s not just that. There’s a few big problems with Rust async aside from the normal coloring problem that is inherent to async and not worth talking about. * The async runtime and async functions are decomposed but tightly coupled. That means while you could swap out runtimes, a crate built against one runtime can’t generally be used with another unless explicitly designed to support multiple. I believe C++ has a si…

Async in traits feature doesn’t use boxing (which is coming in 28 December), only async-trait crate use boxing.

Re: Was Rust Worth It?

#409

Earlier quoted context omitted.

ASTs

An Abstract Syntax Tree / or Double-Linked List both qualify, but they're also a lower level implementation detail than I'd expect to frequently interact with in a reference safety focused language. I've still been meaning to write something in / learn Rust's ways of thinking; is there not an intended replacement for these data structures? Or do they expect it all to go under Unsafe?

> is there not an intended replacement for these data structures? Or do they expect it all to go under Unsafe?

For linked-lists, there's one in std and the majority of people should never have to write their own as it's error prone and requires unsafe.

For graph use-case then you can either use ECS, arena, ref counting or unsafe, but you're probably better off using/developing a dedicated crate that optimizes it and abstract it away behind an easy to use (and safe) interface.

Re: Was Rust Worth It?

#410
I'm glad to see there's a wide range of opinions here.

I'm not too concerned with performance or safety (since my code hasn't been seen very often).

I use rust just because it has a lot of "libraries that help me develop".

While other language libraries have a poor search experience and ranking system, Rust has a great library search system.

I use it because I don't have to read blog posts like C/C++ or java to find libraries that help me develop, or wade through unnecessary libraries like C# or go, I can use the rankings, and it has a good documentation system.

Post reply on HN