Timeline for Avoiding the goto voodoo?
Current License: CC BY-SA 4.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 29, 2021 at 9:24 | comment | added | gnasher729 | Then case OneAndFour is added… | |
| S Jan 23, 2019 at 18:11 | history | suggested | Tvde1 | CC BY-SA 4.0 | fixed the code and made it prettier |
| Jan 23, 2019 at 10:54 | review | Suggested edits | |||
| S Jan 23, 2019 at 18:11 | |||||
| Jan 22, 2019 at 16:35 | comment | added | user949300 | @T.E.D. Agreed. In the revised question where you are simply incrementing an integer, OO might be overkill... :-) But in the general case something "OO like" works fine. In more dynamic languages like Python or JS there isn't even that much extra work to setup, though Java would be more work. | |
| Jan 22, 2019 at 16:01 | comment | added | T.E.D. | I actually did my Master's thesis on using runtime polymorphism to get rid of the gotos in compilers' state machines. This is quite doable, but I've since found in practice its not worth the effort in most cases. It requires a ton of OO-setup code, all of which of course can end up with bugs (and which this answer omits). | |
| Jan 22, 2019 at 11:44 | comment | added | Lightness Races in Orbit | Some people, when faced with a problem, say "I'll just use polymorphism". Now they have two problems, and polymorphism. | |
| Jan 22, 2019 at 0:36 | comment | added | user949300 | Wow, I think this is the first time I've ever been downvoted for suggesting polymorphism. :-) | |
| Jan 22, 2019 at 0:15 | comment | added | Deduplicator | Proclaiming anything the best sight unseen is certainly very brave. But without additional info, I suggest a bit of scepticism and keeping an open mind. Perhaps it suffers from combinatorial explosion? | |
| Jan 21, 2019 at 23:58 | comment | added | Erik Eidt | +1 for suggesting polymorphism, though ideally that might simplify the client code down to just "Call();", using tell don't ask -- to push the decision logic away from the consuming client and into the class mechanism and hierarchy. | |
| Jan 21, 2019 at 23:30 | history | edited | user949300 | CC BY-SA 4.0 | Filled out the etc... |
| Jan 21, 2019 at 23:01 | history | answered | user949300 | CC BY-SA 4.0 |