Re: The 'goto' debate
- Posted by rolf.schroeder at desy.de Feb 06, 2002
- 472 views
My simple meaning to the long lasting GOTO debate: The GOTO (better: 'jump', or whatever is equivalent to it) is simply PRACTICAL, and all arguments due to the so called 'good programming style' is nonsense as far as the code will be much easier to write/read, and that's the main point of Euphoria! When I had to transfer code formerly written in FORTRAN and BASIC (FORTRAN and today BASIC does not need a GOTO, but it's used sometimes) it was a lot of work to transfer it to Euphoria, and the 'structured code doesn't look cleaner. As it's easy to (mis)use GOTOs to write 'unreadable' code, so it's easy to write 'unreadable' code with structured elements like 'if.. then.. elsif.. ..else.. end if'. The arguments pro GOTO - from the standpoint off the high level programmer - was said often, and I will not repeat it here. Only one serious reason might stand against introducing a GOTO (only inside sub routines of course!), namely, if it would slow down Euphoria's execution speed, nothing else, dot. Another solution would be to write a (Euphoria) program which automatically translates code (i.e. BASIC or FORTRAN) with GOTOs into 'clean' structured Euphoria code. I don't know of any EFFECTIVE program to do the job (don't come with the simple 'GOTO ... :LABEL' peace, which easily could be replaced by 'if ... end if'). Don't be a fanatic or fundamentalist, and have a nice day, Rolf