Re: GOTO examples in EUPHORIA´s source
- Posted by Jeremy Cowgar <jeremy at cowg?r.c?m> Jun 05, 2008
- 593 views
Shawn Pringle wrote: > > I see some examples in EUPHORIA'S source code using goto. There are some > macros and I am glad we do not have those in euphoria containing goto. > > > #define thread() goto loop_top > #define thread2() {pc += 2; goto loop_top;} > #define thread4() {pc += 4; goto loop_top;} > #define thread5() {pc += 5; goto loop_top;} > #define threadpc3() {pc = (int *)pc[3]; goto loop_top;} > #define inc3pc() pc += 3 > > All of these goto examples can be replaced with 'continue'. I suppose the > reason to eliminate goto is to encourage keywords like continue and exit. > That's not the case. Euphoria internally uses different methods to jump from routine to routine based on what the compiler allows. There is direct threading, indirect threading, call threading (which is function calling and is the slowest), switch threading (often uses goto), etc... The fact that goto is used here is due to speed. Euphoria is one fast interpreter, you goof with it's uses in the macros you stated here and out the door goes any type of speed. We would start comparing our language speed to Ruby and Python instead of compiled languages. -- Jeremy Cowgar http://jeremy.cowgar.com