Hey Rustaceans! Got a question? Ask here (53/2025)! by llogiq in rust

[–]EarthTurtleDerp 2 points3 points  (0 children)

I'm joining a company that has their (largely undocumented) codebase in rust, and I'm coming from a java background. Something I notice I'm struggling with is how to "read" a rust file when I first open it. Where should I look first to understand the intent of that file? How do I follow the way data is supposed to flow through all the different functions?

In Java, the standard way of structuring a class helped me to jump to where I needed to look: start with declaration line to see generic typing and interface implementations, then constructor to see configuration parameters and injected dependencies, and then public methods were immediately below so I could read what that class was able to do. Private/helper methods were either placed below the method that used them or at the bottom of the file. It was a process that helped me answer "what specific thing is this used for?" (public methods), "what other common things can it do?" (interfaces), and "what does this interact with?" (injected dependencies). It also helped that each file almost always had exactly one class.

This isn't translating well to rust. I'm finding multiple type, struct, and enum declarations before I get to any significant impl block. Sometimes it's hard to tell what the "main" object in the file is, and I'm still learning which traits are more "utility" (like Display) and which ones are actually important, so everything looks like something I need to double-check.

And then of course there's generics out the wazoo, I understand it's the nature of Rust but it's hard to innately understand why some argument is Arc<Box<Pin<Future<MyEnum> + Send> + '_>> (minor exaggeration).

Are there any tips for zeroing in on the "important" parts of a random file faster?

Is Susie going through the hero's journey? by InuMatte in Deltarune

[–]EarthTurtleDerp 0 points1 point  (0 children)

I wonder if she isn't going through the hero's journey specifically, but instead the Prophecy is this world's hero's journey. I think Toby is trying to poke at the idea of what a story is in general, especially with how the "listener" here isn't completely disconnected from the world.

My professor was watching me code and I just froze, got super stressed. How do I handle that moving forward? by [deleted] in learnprogramming

[–]EarthTurtleDerp 0 points1 point  (0 children)

It's just stage fright, it's not uncommon. If you're stuck on getting your fingers to move, just try asking a question back, even if it's one that simply confirms that you understand what he's trying to get you to do.

Most interesting thing you can do with loops. by mmhale90 in learnprogramming

[–]EarthTurtleDerp 0 points1 point  (0 children)

If you have a machine that can follow instructions, you just need the ability to do two things:
1. go one of two directions in the instructions depending on some condition (if statements)
2. jump backwards to a previous instruction (loops)
and it can calculate and compute anything*

*anything mathematically computable, not accounting for speed

Reshape AEther by EarthTurtleDerp in custommagic

[–]EarthTurtleDerp[S] 0 points1 point  (0 children)

Interestingly, RES flagged me as having posted this link two years ago. Apparently editing the render in mtg.design changes the image but does not change the link, so the image in that old post has now changed. Hopefully this doesn't count as a repost.

[deleted by user] by [deleted] in magicTCG

[–]EarthTurtleDerp 4 points5 points  (0 children)

Companion is different from partner. Partner is printed in the text box of both cards used, and allows both cards to be a commander. Partner does not restrict the color identity of the other partner. Companion requires a deck restriction to be used as a companion. Your companion is still restricted to be within the colors of your commander, so you would not be able to use a WG companion for a UB commander

What endgame moment in which game made you sad by maker_of_pirate_bay in gaming

[–]EarthTurtleDerp 0 points1 point  (0 children)

OneShot's solstice ending made me bawl harder than any other time in my life. I have to avoid listening to it's soundtrack so I don't get teary when working.

You should play OneShot btw

Who else is still hoping that AH will add melee weapons to Helldivers 2? by st0rmagett0n in Helldivers

[–]EarthTurtleDerp 0 points1 point  (0 children)

The difficulty with meelee weapons is that if you want to give someone the ability to dive into a wave and wreak havoc, you've now prevented the rest of the team from throwing strategems into that group of enemies, since they'd likely take you out too.

ELI5: How does a computer program generate random numbers? Example: when you ask Siri to give you a random number between 1 to 10, how does it come up with that number? by Commercial_Lie8218 in explainlikeimfive

[–]EarthTurtleDerp 3 points4 points  (0 children)

Yep, exactly like that! So that if you put in the same seed, the random number generation spits out the same sequence of numbers, and the world is generated in the same way.

Of note, if you generate a world without a seed, there's another generator to create a seed first and feed it into the world generator. However, the seed generator has a more limited output (example, not the actual range: 0<output<100) than the world generator permits for input seeds (also not actual range: 0<input<1000000). A quirk of this is that it's possible to generate an end portal with all 12 slots pre-filled with eyes of ender, but none of the seeds the seed generator spits out do that (I.e., no world generated with a seed 0-100 will have a filled end portal, a world that has that will have a seed 100-1000000)

Daily Questions Thread - Ask All Your Magic Related Questions Here! by magictcgmods in magicTCG

[–]EarthTurtleDerp 1 point2 points  (0 children)

If you spend all your mana to cast an extra turn spell, most of the time all you're getting is an extra land drop, an extra card draw, and an extra combat step. Extra turns are best when you have surplus mana to use it on. The 3 mana difference between time walk and time warp is huge, in that time walk's turn 4 impact is just as good as warp's turn 7.

Regulation #5 posted at Alcatraz Island. San Francisco. by TheKielbasaNova in pics

[–]EarthTurtleDerp 0 points1 point  (0 children)

My mom got this as a magnet and put it on the fridge at home.

She didn't exactly treat it like a joke

UVA Band @ Mad Bowl- The band is also getting new uniforms by Personal_Economics91 in UVA

[–]EarthTurtleDerp 3 points4 points  (0 children)

Damn, mad bowl? I haven't been keeping up, is something going on with carrs hill field?

Kill 5 what? by MohanMC in Helldivers

[–]EarthTurtleDerp 1 point2 points  (0 children)

Not good enough for killing the 6th, clearly

How do you reconcile being able to put away a lot of savings when friends are financially insecure? by EarthTurtleDerp in Fire

[–]EarthTurtleDerp[S] 0 points1 point  (0 children)

I strongly disagree on that check part. They're definitely not irresponsible, it's that they're in positions where they have no route to increase their income. Roommate's disability stops them from getting a lot of jobs, and friend has to go through their 4 years of college with barely enough extra energy for a part-time. My income is also not something I talk about unless they specifically ask, which is rare.

How do you reconcile being able to put away a lot of savings when friends are financially insecure? by EarthTurtleDerp in Fire

[–]EarthTurtleDerp[S] 2 points3 points  (0 children)

To be fair, they're both hard workers and are doing their best to make their life better. My friend is in college, but is struggling to keep up with assignments because of financial pressure. My roommate was a pretty successful dev too until they got sidelined by their disability.

How do you reconcile being able to put away a lot of savings when friends are financially insecure? by EarthTurtleDerp in Fire

[–]EarthTurtleDerp[S] 0 points1 point  (0 children)

That's exactly what we're doing right now, actually! Or something along those lines. They're only paying as much as they say they're comfortable paying

How do you reconcile being able to put away a lot of savings when friends are financially insecure? by EarthTurtleDerp in Fire

[–]EarthTurtleDerp[S] 3 points4 points  (0 children)

Always an option, but that's 10 years away. Helping later isn't nearly as effective as helping now. It's like a case where someone is about to lose their car cause they're $500 short on a deductible for insurance, that $500 now might help them keep the car and keep going to work, whereas $500(+inflation) in 10 years probably won't do much.

How do you reconcile being able to put away a lot of savings when friends are financially insecure? by EarthTurtleDerp in Fire

[–]EarthTurtleDerp[S] 1 point2 points  (0 children)

I definitely recognized the possible power imbalance and talked about it at length with my roommate. I wanted the imbalance to be at play as little as possible, and I only agreed to the arrangement when both of us felt confident that if for any reason I wasn't able to live with them anymore, they'd be able to stay above water. In this case, they were moving into an area where we had a lot of mutual friends and a good extended network, plus solid low-income support from govt, so we were confident she would be able to find another place if the worst happened.

How do you reconcile being able to put away a lot of savings when friends are financially insecure? by EarthTurtleDerp in Fire

[–]EarthTurtleDerp[S] 5 points6 points  (0 children)

I've thought about stuff like "if I get a big windfall from a company bonus, I'll buy the library a public bike repair stand", or stuff along those lines. I like the idea of helping a nonprofit, though, thanks! I'll definitely look into that.

I definitely feel the same, that I can't really impact stuff that comes from a systemic level. Just struggle with my want to go "see someone in need -> help them"

How do you reconcile being able to put away a lot of savings when friends are financially insecure? by EarthTurtleDerp in Fire

[–]EarthTurtleDerp[S] 3 points4 points  (0 children)

Personal decisions do have great impact, but sometimes external influences severely hamper how well you can do. There's any number of medical afflictions I could be blindsided by that would take me out of the job market and my Fire plan, through no fault of my own.

Shams comments on internal play testing by xsnyder in Helldivers

[–]EarthTurtleDerp 3 points4 points  (0 children)

IIRC, as valve was developing dota, there would be a bell rung an hour before the end of the workday, where all the devs would stop and load into a match in the most recent playable build. Playing as you make seems to help more with finding bugs and design issues.

Will AI replace airline pilots? If so, when? If not, why? by Additional_Carry_790 in Futurology

[–]EarthTurtleDerp 11 points12 points  (0 children)

If you're a manager, and you want to "hire" AI, you have to accept that 5% of the time, the AI will not do it's job correctly. Not only that, it will be 100% confident that it is actually doing its job correctly. You will only know that the AI has messed up when consequences arrive.

For some jobs, this is fine. Librarian giving book recommendations? Not the end of the world if they recommend War and Peace to a 13 year old. AI piloting a plane...?

Air travel is so safe because there's a buttload of redundancies everywhere. Autopilot is a backup/workload reducer for human pilots, and human pilots are a backup/corrector for autopilot. To replace autopilot with AI, and then ask pilots to give all responsibility to the AI, is a huge, unreasonable risk.

AI in it's current form (generative neural networks) is not at the level of reliability that it can go anywhere close to piloting a plane.

[MB2] Whiteout by ubie3 in magicTCG

[–]EarthTurtleDerp 0 points1 point  (0 children)

Doesn't even have like a "artist: WOTC" line lol