this post was submitted on 08 Apr 2025
492 points (98.2% liked)

Programmer Humor

35560 readers
129 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

Bye bye stack was nice knowing you.

all 21 comments
sorted by: hot top controversial new old
[–] [email protected] 40 points 1 month ago (2 children)

It's ok, the stack overflow is the exit condition.

[–] [email protected] 7 points 1 month ago
  File "<python-input-0>", line 2, in a
    a()
    ~^^
  [Previous line repeated 988 more times]
RecursionError: maximum recursion depth exceeded
[–] [email protected] 19 points 1 month ago (2 children)

Even better when instead of recursive function calls, it a recursive process fork!

[–] [email protected] 19 points 1 month ago

Knock knock!

Race Condition!

Who's there?

[–] LouSlash 8 points 1 month ago (1 children)

Even better:

Before forking locally, fork it on another machine!

[–] [email protected] 2 points 1 month ago

Insert evil laugh here

[–] [email protected] 16 points 1 month ago* (last edited 1 month ago) (1 children)

That's hilarious, reminds me of this.

[–] [email protected] 3 points 1 month ago

Well played 👏👏

I guess I just got, recurse rolled?

[–] [email protected] 9 points 1 month ago (1 children)

the non-recursive part of this image is mildlyinfuriating

[–] [email protected] 6 points 1 month ago

That's the static variable in the function sticking around and watching the madness unfold.

[–] [email protected] 6 points 1 month ago (2 children)

Wait, is it possible to create a real infinite droste effect with vector graphics since they aren’t limited by resolution?

As long as you can do recursion in the xml it should be possible to make an svg that’s “infinitely” recursive yes?

(I have no experience on this topic)

[–] [email protected] 2 points 1 month ago* (last edited 1 month ago)

Depends on how the format represents the image. My impression is that it's in a way that's implicitly limited to smooth (so definitely not fractal) curves.

You're never going to fit infinite detail in finite information, of course. At best you can loop through the finite information.

[–] [email protected] 1 points 1 month ago (1 children)

Would it be an infinite file then? I guess unless you restrain the max file size. But as you're zooming in, it will keep making more microscopic image, it's kind of like a function that keeps approaching x value yet never reached it.

My brain hurts

[–] [email protected] 4 points 1 month ago

Well the svg file itself wouldn’t be, but whatever tries to render the image might think the file is infinite since it’d loop around forever. Come to think of it, I’d imaging there are probably safeguards in place to prevent svg files like this hypothetical one from being opened because they’d run as an infinite loop

[–] litchralee 5 points 1 month ago

I'm reminded of Matt Parker demonstrating recursion in Microsoft PowerPoint:

https://www.youtube.com/watch?v=b-Fa6HtvGtQ

[–] [email protected] 5 points 1 month ago

My exit condition is when the stack overflows

[–] [email protected] 1 points 1 month ago (1 children)
[–] [email protected] 1 points 4 weeks ago

Nope, stolen from a Telegram group chat, not sure where it's originally from.