Live data from Hacker News

Was Rust Worth It?

jsoverson.medium.com

431–440 of 736 posts

Re: Was Rust Worth It?

#431

Earlier quoted context omitted.

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…

> It has perfomant memory options that other GC languages lack, and great builtin packages to use.

As clarification for the audience, it isn't the only GC enabled language with C and C++ like capabilities, in fact there are several examples since the early 1980's.

The adoption push for Java and scripting languages distorced the understanding of what was already available out there.

Re: Was Rust Worth It?

#432
post #140

Earlier quoted context omitted.

I'm honestly astounded at how badly many languages have implemented dependency management, particularly when Java basically got this right almost 20 years ago (Maven) and others have made the mistakes that Java fixed. With Maven you get: 1. Flexible version (of requirements) specification; 2. Yes, source code had domain names in packages but that came from Java and you can technically separate that in the dependency…

> Later comes along Go. No dependency management at the start. There ended up being two ways of specifying dependencies. At least one included putting github.io/username/package into your code. That username changes and all your code has to change. Awful design. "github.io/username/package" is using a domain name, just like Java. Changing the username part is like changing the domain name--I don't see how this is any…

Note that in Java it is merely a convention to use domain names as packages. There is no technical requirement to do so. So moving to a different domain has no impact whatsoever on dependency resolution. Many people use non-existent domain names.

To be honest I really like how Java advocated for verbose namespaces. Library authors have this awful idea that their library is a special little snowflake that deserves the shortest name possible, like "http" or "math" (or "_"...).

Re: Was Rust Worth It?

#433
post #367
post #320

Earlier quoted context omitted.

> I just wish Rust learning resources would be more upfront about this. While beginner resources don't dwell too much upon cyclic references, they don't consider unsafe blocks as unusual. All the material I've seen say that there are certain domains where Rust's compile-time safety model simply won't work. What Rust allows you to do instead, is to limit the scope of unsafe blocks. However, the beginner material often…

> Cyclic references can be dealt with runtime safety checks too - like Rc and Weak. Indeed. Starting out with code sprinkled with Rc, Weak, RefCell, etc is perfectly fine and performance will probably not be worse than in any other safe languages. And if you do this, Rust is pretty close to those languages in ease of use for what are otherwise complex topics in Rust. A good reference for different approaches is Learn…

Except in those other languages the compiler types .clone() for me.

Re: Was Rust Worth It?

#435
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

Your parent said "frequently encountered" and while it's probably true that doubly linked lists may be "frequently encountered" in some people's code they're usually a bad idea and "don't use a list here" is often the right fix, not "conjure a way to make that safe in Rust".

It's very noticeable how often people who "need" a linked list actually only wanted a queue (thus Rust's VecDeque) or even a growable array (ie Vec).

Aria has a long list of excuses people offer for their linked lists, as well as her discussion of the time before Rust 1.0 when she sent lots of Rust's standard library collections to that farm up-state but wasn't able to send LinkedList.

https://rust-unofficial.github.io/too-many-lists/

Re: Was Rust Worth It?

#436
post #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…

> At this point, I'm about as fast in Rust as I am in Python.

This is factually impossible.

For anything larger than (very) small programs, Rust requires an upfront design stage, due to ownership, that it's not required when developing in GC'ed languages.

This is not even considering more local complexities, like data structures with cyclical references.

Re: Was Rust Worth It?

#437
post #397

Earlier quoted context omitted.

I've finally set my mind to properly learning a new language after Python, Haskell, and typescript. I'm looking into Rust especially because of how I've heard it interoperates with Python (and also because it's maybe being used in the Linux kernel? Is that correct?).

Rust is an excellent follow up to those languages. It's got many influences from Haskell, but is designed to solve for a very different task that's not yet in your repertoire so you'll learn a ton. And yes the Python interop is excellent.

I'm sold, thank you. Yes, it felt like a great "missing quadrant" to my generalist skillset.

Re: Was Rust Worth It?

#438
post #347

Earlier quoted context omitted.

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

Also, a parent field is something you should be able to infer, e.g, keep a stack of parents as you traverse down a search tree following the child pointers, instead of storing parent pointers in the tree nodes.

Re: Was Rust Worth It?

#439

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.

I used to be .NET dev and don't agree. Couple of reaons: 1) Modern Java is almost as good as C# with some things I can't give up in Java (static imports => succint code, Groovy Spock => succint tests) 2) Kotlin is better than C# 3) JVM has much much bigger ecosystem (almost all the apache projects are JVM oriented) and default web framework is much less code to type (SpringBoot) is much more productiv 4) JVM has wide…

Java is surely keeping up but I can't name single Java feature that I miss in C# or is implemented better in Java. I haven't used Java in a long time though, just occasionally I read about new Java features and I've never said to myself "cool, I wish I had it in C#".

Static import are also available in C# for quite some time now (c# 6, released in 2015, and in C# 10 you can even make this import global for for project).

I haven't used Kotlin, is there any killer feature compared to C#? (except more succinct code in certain cases?)

Re: Was Rust Worth It?

#440

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.

C# is a lovely language to work with. The only issue I have is with the .NET ... that is, building self-contained binaries to distribute. For comparison: * Hello World win-x64 binary self-contained in .NET 7 is around 70 MB * The same for Go results in 1.2 MB Edit: Missed 'trimming' in .NET, which would result in a binary of size around 11 MB in win-x64

This is an unfair comparison of apples to oranges by building the binary with the wrong flags. .NET produces smaller binaries than Go with NativeAOT (despite including more features).
Post reply on HN