Hacker Newsnew | past | comments | ask | show | jobs | submit | a_rustacean's commentslogin

Open-source maintainers should merge everything that _I_ consider reasonable, because _I_ know better than them!

If they don't, I'll call it a tragedy.


It's easier to understand the future consequences and limitations of code you wrote yourself.

The main challenge in open-source is communication.


`Rc` freezes the value as long as it's shared unless you use interior mutability. It's fine when you want to share immutable data, but if you ever need to mutate its contents you will have to deal with awkward cases and situations, and at runtime!

Wrapping everything in `Rc` is not a good default strategy. Instead figure out an architecture that works well with the borrow checker! This normally means thinking hard about your data structures and the ownership model of your application.

I love Rust precisely because of this. You can leverage the compiler to drive your development and design. If it's hard, then it's probably wrong!


> I love Rust precisely because of this. You can leverage the compiler to drive your development and design. If it's hard, then it's probably wrong!

Yes, I had the same experience writing code in Rust and Haskell. If the design works nicely with the language, then also the design is better, more modular, simpler dependencies and easier to understand and extend.


Are there any good resources for design patterns in Rust? I've gone through Rust by example and am writing mid-size rust programs now but would love to check my work against the experts.


There's The Unofficial Rust Design Patterns Book...

https://rust-unofficial.github.io/patterns/

(More generally, there's the Little Book of Rust Books to find things like that: https://lborb.github.io/book/ )

...and someone asked about good code to learn from on Reddit a day or two ago and was advised to read basically any code by dtolnay or burntsushi, two of the big wizards who feel like they've written half the Rust ecosystem at times.


Rust also just enforces good C++ practices, so you could just get yourself familiar with the 40 years history of C++.


I'll stick to my Rc's, thanks. Limiting yourself to immutable data is a good idea anyways for all scenarios where it is possible.


> If it's hard, then it's probably wrong!

Trees and graphs?


The borrow checker gets to actively tell you that your family tree has some inbreeding!


What the problem with trees? They are trees, not cyclic graphs.


"I don't understand it, therefore there is something suspicious about it" is a very dangerous way of reasoning.

We burned innocent people because of this not long ago.

Anyways, I find the Bitcoin paper very approachable. You may need to read it a bunch of times until everything clicks into place. But it's all there, in just 8 pages.


Humans haven't changed. We just like to pretend we have and are superior now. Pick any random person and put them back in the middle ages, they'd be burning witches and screaming of joy at gladiator matches.


Are you comparing my distrust of crypto to the Salem witch trials?

Right...

Anyways, the golden rules of investing is to not invest your money into something you don't understand.


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

Search: