Principal Engineer for Accumulate

  • 5 Posts
  • 86 Comments
Joined 1 year ago
cake
Cake day: June 12th, 2023

help-circle


  • Using git reset --keep would just make more work since I’ll have to throw away uncommitted changes anyways. Removing uncommitted changes is kind of the whole point, it is called ‘reset’ after all. If I want to preserve uncommitted changes, I’ll either stash them or commit them to a temporary branch. That has the added benefit of adding those changes to the reflog so if I screw up later I’ll be able to recover them.







  • Ethan@programming.devtoProgrammer Humor@programming.devGo vs Rust learning
    link
    fedilink
    English
    arrow-up
    0
    arrow-down
    1
    ·
    4 months ago

    Ananace and the article they linked are using their dislike of Go to conclude that it’s a bad language*. It is not a bad language. Every language has hidden complexity and foot guns. They don’t like Go. Maybe you won’t like Go. That’s ok. But that doesn’t make Go a bad language. The language designers are very opinionated and you might dislike them and their decisions.

    I haven’t used Rust but from what I’ve seen, it’s a lot less readable than Go. And the only thing more important than readability is whether or not the code does what it’s supposed to do. For that reason I doubt I’ll ever use Rust outside of specific circumstances.

    *I’m using “a bad language” as shorthand for “a language you shouldn’t use”. Maybe they don’t think it’s bad but amounts to the same thing.





  • Programming languages are tools. I couldn’t care less about learning a new tool just for the sake of learning. My interest in learning tools is exclusively practical - if they help me do my work better.

    I find functional languages interesting, but that’s because I find the underlying theory interesting and worth learning for its own sake, not because I actually care about the specific language it’s written in. Even then these days I’d rather learn about woodworking (which is currently my main hobby) than a programming paradigm I’m probably never going to use.


  • I think the author’s primary point is, “Merging changes sucks, don’t make your users do that,” with a corollary: if your program loads configuration from a directory that is only populated by the user, there’s nothing to merge and thus never any merge conflicts. Case in point: /etc/polkit-1/rules.d. I can add whatever rules files I want in there and they’re never going to conflict when I update. If PolKit makes breaking changes to the format, it will log errors somewhere and I can look at those errors, look at my rules, and figure out how to fix them. That’s a hell of a lot easier than merging conflicting changes to code/configuration.


  • Additionally, switch performs extra sanity checks that checkout doesn’t, for example switch would abort operation if it would lead to loss of local changes.

    What checks? Under what situation does checkout lead to loss of changes? If I make changes and attempt to checkout a ref that would overwrite them, I get the following error:

    error: Your local changes to the following files would be overwritten by checkout:
            some/file
    Please commit your changes or stash them before you switch branches.
    Aborting
    

    To my knowledge it’s not possible to overwrite changes when switching branches/refs (git checkout <ref> without any other arguments or flags) so I guess what the author really means is, “If you use checkout incorrectly you can overwrite local changes.” As far as I can recall I’ve never accidentally git checkout <ref> <some/file> so I don’t see a reason to retrain my muscle memory. I do use git restore since it’s behavior is a lot more obvious than checkout/reset though sometimes I still use git checkout <ref> -- <some/file> because muscle memory.


    • Scenario: I’m in the middle of writing a new feature.
    • Boss, to me: “Shit broke. Go figure it out.”
    • Me, thinking: I’m in the middle of doing some complex work. If I commit/stash and close the open files, it will take a day for me to remember WTF I was doing.
    • Me: “Oh look, worktrees! I can leave my workspace intact with all the files open, pending changes, test results, terminal output, everything! And just create a new worktree to checkout the production version and debug! I’m saved!”

    Also setting up a worktree is really easy. git worktree add ../hotfix prod-branch && cd ../hotfix and get working. Though in reality it’s cd ../hotfix && git checkout prod-branch because I’ve never needed more than one secondary worktree.