Re: GOTO examples in EUPHORIA´s source

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu