Yo whatup

  • 0 Posts
  • 16 Comments
Joined 1 year ago
cake
Cake day: September 28th, 2023

help-circle
  • So the big important part of git is that it’s a collection of commits. A branch is just a labeled commit and each commit is a list of what changed from the parent. Rebasing (the most confusing one for people) is when you fiddle with a commit from underneath yourself. Or in even more simple terms editing a parent commit. Rebasing is extremely powerful but most useful for when you notice a bug you wrote a couple commits ago. Fixing such issues via rebase (or !fixup commits you auto squash at the end) keeps your history clean. It’s as though you never wrote the bug. The other thing you do a lot with rebasing is moving your branch up in the history cause somebody updated the remote.






  • Yup, libraries should usually let the consumer chose what to do with an error, not crash the program without a choice in the matter. The only real exception is performance critical low level code such as the core of a graphics or audio driver. Though in those cases crashing also often isn’t an option, you just power through and hope things aren’t too screwed up.





  • I’d probably say it depends but I’m no Rust expert and I have no direct experience with C (though quite familiar with C++).

    Basically I’d expect writing C to be easy, but not safe. IE you can quickly and easily write C that compiles but has runtime issues. Rust for the most part will catch everything but logic issues during/before compilation meaning once the program runs you’ll have very high confidence in it’s runtime behavior leading to time spent “fighting the compiler” instead of figuring out wtf is going wrong at runtime.


  • Yes Rust is harder to write than C, that’s basically by design as it’s due to the statically guaranteed memory safety. That’s pretty magical. C doesn’t have that and neither does C++ even with smart pointers and such. Rusts unsafe keyword is poorly named, what it actually does is tell the compiler that you the programmer guarantee Rusts rules are upheld within the unsafe block.

    For example

    Access or modify a mutable static variable

    That is a global, that’s incredibly hard to impossible to statically prove it’s safely done, so you have to do it in an unsafe block. So you violating Rusts rules within an unsafe block is actually using the unsafe block wrong. That’s not what it’s for