Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

COMEFROM control flow

According to wikipedia COMEFROM flow control is considered a joke, unreadable or downright harmful. I'd imagine such a feature would be very useful in AOP scenarios (ie. adding logger to methods without adding logger calls to methods).

Does the downside of non-obviousness of such a control structure outweigh the potential usefulness? Are there any other downsides to consider?

Prompted to ask this question because of this.

like image 253
Goran Avatar asked May 11 '11 08:05

Goran


1 Answers

For starters is basically useless in any modern language because you need to either:

  • Reference the position to jump from by line number, and these are volatile.
  • Place a marker or label in the code to denote a position that can be jumped from, thus destroying any possible benefits of not needing to do this.

Also:

  • Makes any kind of debugging by inspection essentially useless.
  • Can't really capture any context from where it jumped unless you keep variables persistant, which is asking for trouble.

A much better idea would be to instead:

  • Write a hooking API.
  • Call a function!
like image 198
thomasfedb Avatar answered Oct 15 '22 13:10

thomasfedb