Re:Confessions of a terrible programmer
by gne1963 on Saturday March 14, 2009 @05:01PM
(#516173)
Ok I admit that when I used BASIC back in 1979, I put GOTOs in my code.
[ Parent
| on HN ]
So what?
GOTO isn't evil, it just has no meaningful context without a comment or convention. All the classic 'structured programming' control structures are nothing but simple conjugations of conditional GOTOs -- what they provide is idiomatic context.
Re:Confessions of a terrible programmer
by parenthesis on Saturday March 14, 2009 @06:59PM
(#516277)
E.g.:
clisp> (macroexpand '(dotimes (i n) blah blah blah))
(BLOCK NIL
(LET ((I 0) (#:COUNT-2814 N))
(TAGBODY
#:LOOP-2815
(IF (>= I #:COUNT-2814)
(GO #:END-2816))
BLAH BLAH BLAH
(PSETQ I (1+ I))
(GO #:LOOP-2815)
#:END-2816
(RETURN-FROM NIL (PROGN NIL)))))
(goto in Common Lisp is (go ...) )Of course we all understand (or are forced to use) structures now, but back then GOTOs were evil. We did not have the structural classics we have now. We had to build them. (and use them).
Naked GOTOs were indeed evil and led to endless loops and sleepless nights. There was no structure to them.
Pascal was our savior.