Hacker News new | past | comments | ask | show | jobs | submit login

The articles makes a good a case of how Rust can look as clean as other high-level programming languages when writing high-level business logic.



I agree that Rust has some really great concepts. The example code makes heavy use of traits for example, which are very ergonomic and provide a dynamic feel.

The context is a rewrite AKA runtime optimization. So the result is already understood. A great use-case for Rust is top-down implementation.

Also the code doesn't show any of the more painful cases. From the article:

> There are some inefficiencies visible here, and they're probably the most important spots for performance improvements. But they're still there as fixing them was too hard and/or time-consuming for me.

Resolving these "inefficiencies" is where Rust really shines. Because it _can_ resolve them and does it internally consistent on top of it. But at the same time, this is where you really _slow down_ in development and need to think about the more complex and intricate concepts such as lifetimes and borrow semantics.


As someone who has been writing a lot of Rust, I think that's only apparent... there's lots of things you can't do in Rust that you can in a GC-based language. The restrictions Rust imposes on you (mostly about the borrow checker, especially when you have mutable values) makes it much harder to write code... if you make it easier by cloning happily, you might end up with worse performance than in the GC-based language. If you don't, I guarantee your code won't look pretty with all those lifetime annotations.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: