3 ms·
Ok I admit that when I used BASIC back in 1979, I put GOTOs in my code.
by gne1963 18y ago
Ok I admit that when I used BASIC back in 1979, I put GOTOs in my code.
- blasdel 18y agoSo 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.
- parenthesis 18y agoE.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 ...) )
- gne1963 18y agoOf 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.
- ewiethoff 18y agoI smile when I think of Ruby's throw/catch (not to be confused with raise/rescue) as labeled GOTO.