461
WishUnderflow (lemmy.world)
you are viewing a single comment's thread
view the rest of the comments
[-] savvywolf@pawb.social 31 points 3 days ago

I had a visceral reaction to this because obviously the wish count should be decremented before the wish takes place. Even though I can't think up a convincing technical argument for it.

[-] balsoft@lemmy.ml 15 points 3 days ago

If there's parallelism/async involved, then there definitely is an argument to decrement first, execute later. Otherwise you could make a wish for the genie to just wait for an hour and then make as many wishes as you want within that hour.

[-] Gutek8134@lemmy.world 5 points 3 days ago

What if one of the threads crashes while executing the wish? I demand warranty!

[-] Brekky@lemmy.world 3 points 3 days ago

But how can you decrement a future dated wish, since you can't guarantee nothing will happen that prevents the genies ability from executing said wish? E.g. i mean like telling the Genie to do something 5 days from now, not your example which would begin immediately after making said wish.

[-] balsoft@lemmy.ml 4 points 3 days ago

You decrement the wish counter first, execute the action (which includes waiting those 5 days), and if it fails you increment the counter back. Something like this:

wishes = wishes - 1;
executeWish(wish).unwrap_or_else(|_| { wishes = wishes + 1; })?

This way if the action fails in the future, you get a wish back and can ask something else.

[-] CrackedLinuxISO@lemmy.dbzer0.com 2 points 3 days ago* (last edited 3 days ago)

I always thought that wish-granting is instant, even if the effects of that wish are delayed.

So if I wish for something to happen in 5 days, it's granted in the moment and guaranteed to happen. That raises a question though: Can I wish to cancel a wish I have already made, but whose effect has not yet taken hold? On its face, this should be possible, but if we take it as a given that all valid wishes are always granted at the moment of utterance, then it might be physically/psychologically impossible for me or anyone else to revoke the wish before its IRL effect is complete.

[-] tyler@programming.dev 1 points 2 days ago

You’d need a check to make sure they don’t wish for something not allowed (like more wishes).

[-] Skullgrid@lemmy.world 4 points 3 days ago

I had a visceral reaction to this because obviously the wish count should be decremented before the wish takes place.

Why? Shouldn't you decrement the limited resource the user has access to in case the thing you are doing fails?

this post was submitted on 31 Jul 2025
461 points (97.5% liked)

Programmer Humor

25448 readers
1356 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS