Reddit -> Beehaw until I decided I didn’t like older versions of Lemmy (though it seems most things I didn’t like are better now) -> kbin.social (died) -> kbin.run (died) -> fedia.

Japan-based backend software dev.

  • 0 Posts
  • 16 Comments
Joined 1 month ago
cake
Cake day: August 14th, 2024

help-circle







  • I learned c from a book from the 80s and then skipped to rust.

    The only time I touched c++ was modding games in the early aughts and to try it for a couple coding challenges. I’ve heard templates are a thing of note when it comes to complications but not sure.

    As for c# … We don’t talk about that (jk. I had to do it for one or two projects and played with unity a bit ages ago)


  • I can’t address the first part, but for your last paragraph, if you’re sharing with humans, csv is fine. If you’re sharing with humans and machines, JSON or yaml or something similar is probably fine. If you’re only moving things around to give to machines, what to use depends on constraints you might have and use cases



  • They can:

    • stay home - this results in whomever gets the most votes from everyone else getting the electoral votes for that district/state. In many districts, this benefits trump
    • write in someone else - more clearly shows protest, but what that actually does or if anybody really counts it, I have no idea. Effectively the same as option 1 for the outcome of this particular election
    • vote for a third party - basically the same as the above, though certain things do happen if a party gets some percentage of the vote, but not until the next election. The outcome for this election is the same
    • vote for one of the two major candidates - self-explanatory

    How much not voting or protest voting impacts the actual results kinda depends upon the district and state. However, even in a seemingly secure district or state, enough people protest-voting could actually have a negative impact in that particular election (though I find that fairly unlikely). I vote in a rural district that supports trump. Since he’s objectively worse in basically every way and has indicated that he’s willing to let Netanyahu’s government do whatever they want, I feel it unethical to do anything but vote against trump which, given what I wrote above, basically leaves Harris. If I know that trump will be worse, and I know that doing anything other than voting for Harris in my district helps cement trump, then I must vote for Harris or I’m just helping trump.

    We are here because nearly everywhere uses first-past-the-post and voter turnout isn’t great, particularly by voters in local and regional elections. I vote as progressively as I can in local elections and advocate for ranked choice or rated voting wherever possible. People in power tend to hate ranked choice voting or similar because it removes what almost always just becomes a two-party fight which often leads to tactical voting rather than properly representing people. The state in which I vote also has a huge gerrymandering problem, but that’s another story.



  • Very TL;DR version: a variable has an owner. If you pass it off to another function, you no longer own it and can’t use it until/unless it gives the variable back. Rust can be really strict on making sure you aren’t trying to use something you don’t own at that time. The documentation explains it better than this (and I wrote a longer post but accidentally closed the window and lost it). See also mutability and lifetimes for some pain points people might not be used to.


  • I agree with the others who say to start with The Book – https://doc.rust-lang.org/book/

    From there, start trying to create small things that you might want or need to do (parsing JSON is something that I needed to do and I started there).

    From there, you will learn to fight the borrow checker and start to feel how rust is working. This will be annoying at first, but get better over time (at least in older versions of Rust; I haven’t used it in a while so it may be different now).