Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!kth!draken!umecs!rachel!christer From: christer@rachel.cs.umu.se (Christer Ericson) Newsgroups: comp.misc Subject: Re: The "evil" GOTO (Was: 25 Years of BASIC) Message-ID: <852@umecs.cs.umu.se> Date: 9 May 89 10:11:04 GMT References: <1791@ubu.warwick.UUCP> <1436@onion.reading.ac.uk> <1814@ubu.warwick.UUCP> <698@occrsh.ATT.COM> Sender: news@umecs.cs.umu.se Reply-To: christer@rachel.UUCP (Christer Ericson) Organization: Dep. of Inform.Proc.,University of Umea,Sweden Lines: 65 I think all of you who have been discussing GOTO's should take a look at the March '87 issue of CACM and read Rubin's '"GOTO Considered Harmful" Considered Harmful' along with Dijkstra's reply in the August '87 issue and finally Rubin's reply to Dijkstra in the December issue. For those of you who don't have the time to look this issues up here is a small [very small] summary: Rubin states the following problem: "Let X be an N x N matrix of integers. Write a program that will print the number of the first all-zero row of X, if any." Along with this he presents the following program with a goto [also two other programs w/o gotos that are disgusting to look at]: [BTW, I reindented the program a bit] for i:=1 to n do begin for j:=1 to n do if x[i,j]<>0 then goto reject; writeln('The first all-zero row is ',i); break; reject: end; In his reply Dijkstra complained about silly things like that Rubin used lowercase letters [x,n] in the program and uppercase letters [X,N] in the problem specification... He also presented his solution to the problem using a very Dijkstaescue notation [which makes it difficult to retype it here, so I won't try that.] Anyway, in his final letter Rubin expresses his disappointment over Dijkstras reply [which he had all reasons in the world to do!] and also this Pascal version of Dijkstras program: c:=true; i:=0; while c and (i<>n) do begin d:=true; j:=0; while d and (j<>n) do begin d:=x[i,j]=0; j:=j+1; end; c:=not d; i:=i+1; end; if c then skip else print (i-1); I think that the above code says it all... I would like to know if ANYONE think Dijkstras program is easier to read [which IS the question, right?] than Rubins? Go read the original articles NOW! /Christer | Christer Ericson Internet: christer@cs.umu.se | | Department of Computer Science, University of Umea, S-90187 UMEA, Sweden | | "I bully sheep. I say GOTOs are necessary!" :-) |