3 ms·
Unstructured and unrestricted equivalent of goto then is a method call in OOP. Where method is basically a label and object is a shared state it randomly messes
by zzzcpan 8y ago
Unstructured and unrestricted equivalent of goto then is a method call in OOP. Where method is basically a label and object is a shared state it randomly messes with.
- goalieca 8y agoif (False) goto error; vs. if (False) throw ExceptionE;
- jimmy1 8y agoYou highlighted in this comparison why I hate exception handling in OOP languages, and just generally the common practices prescribed for handling errors.
- Gibbon1 8y agoEhem if(False) longjump(error, 1); vs if (False) throw ExceptionE;
- hindsightRegret 8y agoGood job, compiler :)
- coldtea 8y agoThat's not unrestricted though -- control returns to the caller after the end of the function. With goto that's not guaranteed to be the case -- that was the spaghetti part.
- zzzcpan 8y agoNo, that's not a restriction, but just a behavior. It doesn't keep you from jumping all over the place and modifying shared state by calling methods within methods. You can only use conventions to have some restrictions and structure here. Just like with goto.