Submitted by Dacadey t3_z89cro in explainlikeimfive
SuperBelgian t1_iye7700 wrote
Reply to comment by Sloloem in ELI5: why is using "goto" considered to be a bad practice in programming? by Dacadey
There could be a reason for such a structure. Financial institutions often still have very old esoteric hardware, such as mainframes. (Even if not actively used, they still need to keep it functional to access archived data.)
Just, because you can program and compile something without errors, doesn't mean it will run correctly.
Nested functions, calling a function within a function, which calls a function, etc... is a very common way of doing things.
However, some CPUs have a limit on how deep such a stack can go, going as low as to only 4 or 8 stacks deep. (Ex: Arduino.)
Very old hardware doesn't even have such a stacking possibility that allows nested functions.
Sloloem t1_iyed84i wrote
That's all true, you're absolutely right. I was just trying to keep my anecdote from getting too lengthy by leaving out details...in this case the code in question was written in Java in 2009 and running on IBM WebSphere on contemporary datacenter hardware so there were really better ways to have laid it out. Maybe the robots are stack limited which makes sense, but refactoring it is still a good thought experiment if nothing else.
Viewing a single comment thread. View all comments