[Coco] GOTO and code maintainability

wdg3rd at comcast.net wdg3rd at comcast.net
Tue Sep 15 18:55:43 EDT 2009


----- "Aaron Banerjee" <spam_proof at verizon.net> wrote:

> Maintaining the stack is most certainly an important issue.  Several 
> years ago, I wrote a program to solve the "Eight Queens" problem on a 
> coco.  I counted on the fact that you could "jump out of" a for/next, 
> alter the counter, and jump back in order to simulate recursion.  That
> program was more of an academic curiosity, and most certainly not  
> intended to promote jumping in and out of FOR loops.  It ran on ECB  
> 1.0, but not on GWBASIC.
> 
> I think the resounding issue of this thread is that even GOTO can be a
> good thing if used appropriately, just as almost anything can be "bad"
> if misused.

Sorry about the late reply (been rebuilding a bathroom while still holding down a full-time dead-end job with a health plan).

But I'm pretty sure that while it speeds up the program, that is technically a "misuse" of GOTO.  One I've used myself more than once, including both in BASIC (Mod One L2 before the Coco was in planning & many later BASICs) and in the Bourne shell and a couple of its descendants (mostly Korn & Bash, one on AIX machines when I'm properly employed, the other at home [& work desk] since 1993).

I am not ashamed about using conditional or even unconditional branch instructions.  BASIC was pretty much my first language unless you count the mechanical binary on the Digicomp One a decade plus before my TRS-80 Mod 1 Level 1.  (A re-creation of the Digicomp One is available at <http://www.mindsontoys.com/kits.htm?dc1_main.htm> a three-bit CPU where real-time is real time.
-- 
Ward Griffiths        wdg3rd at comcast.net




More information about the Coco mailing list