• 0 Posts
  • 7 Comments
Joined 1 year ago
cake
Cake day: July 9th, 2023

help-circle
  • Best practice when using .unwrap() in production code is to put a line of documentation immediately above the use of .unwrap() that describes the safety invariants which allow the unwrap to be safe.

    Since code churn could eventually cause those safety invariants to be violated, I think it’s not a bad thing for a blunt audit of .unwrap() to bring your attention to those cases and prompt to reevaluate if the invariants are still satisfied.




  • It’s a massive win, and I would question the credibility of any systems programmer that doesn’t recognize that as soon as they understand the wrapper arrangement. I would have to assume that such people are going around making egregious errors in how they’re using mutexes in their C-like code, and are the reason Rust is such an important language to roll out everywhere.

    The only time I’ve ever needed a Mutex<()> so far with Rust is when I had to interop with a C library which itself was not thread safe (unprotected use of global variables), so I needed to lock the placeholder mutex each time I called one of the C functions.


  • People just don’t want to believe that China can win at capitalism because it undermines all their internal narratives around the innovation power of liberalism. I say this as someone who does not personally like China and its authoritarianism.

    The fact of the matter is with a population of nearly 1.5 billion people, you’re statistically guaranteed to have enormous pools of talent to draw on. Even a relatively modest per capita investment in education, focused on key objectives and funneled into the portion of the talent pool that they’ve managed to identify, will be able to yield massive innovation.

    A lot of people will suffer under this authoritarianism. The people from these talent pools will be exploited and burnt out at a young age. This is already happening in China. But as a nation, it will be able to position itself extremely well technologically and economically, and this is a reality the rest of the world needs to be prepared to deal with.



  • Nothing is ever better in every conceivable way than the current state of the art.

    Probabilistically, sure, but it’s not impossible that there has been some piece of knowledge or understanding that’s been missing, and that massive breakthroughs are possible once the process is figured out.

    I think a fair modern example is LED light bulbs. They are better in every conceivable way than incandescent or fluorescent lightbulbs: they last longer, use less energy, shine brighter, use less toxic materials, and are easy to mass produce. But there were several decades where much of the industry believed that LEDs would never be very useful as a light source because we could only produce red and green, and it was generally believed that a blue LED would be impossible to produce.

    Then one guy decided it would be his life mission to invent the blue LED, and the sonuvabitch did it. Now LEDs are the only sensible thing to use to produce light.

    It’s always possible for this kind of breakthrough to happen, especially in material science where the complexity of how molecules interplay is nearly incomprehensible.