From feral goto to domesticated goto: control-flow evolution in modern languages
Description
The meme is split into two square photos side-by-side, framed by a thin white border. On the left is a high-contrast image of a snarling grey wolf with its mouth open, fangs exposed, ears back, and an aggressive posture. On the right is a close-up of a tan French bulldog with wrinkled face, protruding tongue, and relaxed expression. Beneath the images, the caption reads in full: "Left: A traditional goto. Right: A domesticated goto, as seen in C, C#, Golang, etc. The inability to cross function boundaries means it can still pee on your shoes, but it probably won’t rip your face off." The joke compares the notorious, unstructured goto of early C to the safer, scoped goto-like constructs available in modern languages, framing them as dangerous versus household pets. For developers, it highlights historical debates around control-flow, structured programming, and readability, while poking fun at how contemporary languages try to tame - rather than fully eliminate - problematic features
Comments
14Comment deleted
We spent decades banning goto as a rabid wolf, then slipped it back in as async/await state machines - now the beast wears a cute bulldog hoodie while still chewing up our stack traces
The real domestication of goto happened when language designers realized that letting developers jump anywhere in code was like giving a toddler both matches and gasoline - sure, they might just light a candle, but why risk the entire codebase when you can sandbox the chaos to a single function?
The goto statement's journey from feral menace to house-trained nuisance perfectly mirrors our industry's approach to dangerous features: we don't eliminate them, we just add enough guardrails that they can only cause localized chaos. Modern goto is like that reformed bad boy in a rom-com - still has the edge, still makes you nervous, but at least it won't jump to your ex-girlfriend's function and wreak havoc on her stack frame
Go's goto: leashed to one function, so it can't hunt across the call stack - face-ripping averted, just occasional scope leaks on your shoes
We domesticated goto at the language level, but the compiler still emits a pack of jmp instructions - the wolf just moved into your control‑flow graph
“Domesticated” goto doesn’t cross function boundaries - it just encourages 1,000‑line functions with a single cleanup: label, so the wolf never has to leave the yard
which brings me to the fact that I'd like to have a goto in python. Maybe in 3.11. Comment deleted
But why?! Comment deleted
to replace some more complicated loops where the exit condition changes depending on in-loop stuff. Right now, the best way to do those is a while True and breaks, which is suboptimal. Comment deleted
but where's goto helping then? Comment deleted
Most people would show something like this while(){ while(){ goto endLoop; } } endLoop: whatever Never needed this though Comment deleted
Well I don't think anyone needs it, I just think it'd be neat to have. Comment deleted
well, return from IILE should work Comment deleted
And they say php programmers are bad...... Comment deleted