Hacker News new | past | comments | ask | show | jobs | submit login

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.



That'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.


No, 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.


if (False) goto error;

vs.

if (False) throw ExceptionE;


Ehem

   if(False) longjump(error, 1);

   vs

   if (False) throw ExceptionE;


Good job, compiler :)


You highlighted in this comparison why I hate exception handling in OOP languages, and just generally the common practices prescribed for handling errors.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: