Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

INTERCAL is famous for having a COMEFROM instruction, as an inverse of GOTO.

With GOTO, we can read a section of code and if it contains "GOTO N" then we know the execution will jump to location "N", so we can look up that location and keep reading. We have no idea if any other code will jump into the code we're currently reading, unless we search for "GOTO <location we're reading>".

COMEFROM is the opposite: when we're reading a section of code and we see "COMEFROM N", we know that the code at location "N" will jump to this section. We have no idea if the code we're reading will jump to somewhere else, unless we search for "COMEFROM <location we're reading>".

Despite being invented as a joke, this is very popular in mainstream programming, under the name "exception handling" ;)



Exception handling requires some piece of code to actually throw the exception though. A more thorough instantiation of the idea would be aspect-oriented programming.




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

Search: