Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!uw-june!pattis From: pattis@june.cs.washington.edu (Richard Pattis) Newsgroups: comp.edu Subject: Re: is turing the best next language to use in intro classes? Summary: Turing <> Pascal + Modules Keywords: turing, Pascal, CS curriculum Message-ID: <7287@june.cs.washington.edu> Date: 16 Feb 89 16:29:26 GMT References: <1059@oswego.Oswego.EDU> <1989Feb13.182342.2022@ziebmef.uucp> Distribution: comp Organization: U of Washington, Computer Science, Seattle Lines: 36 In article <1989Feb13.182342.2022@ziebmef.uucp>, lea@ziebmef.uucp (Simon Peter Lea) writes: > > > In my opinion, to the average CS undergrad, Turing is just Pascal with > modules. Very similar to Turbo Pascal (4.0 on PC and MAC) - which is of > course similar to Modula, etc. Having used it for the past three years > myself as an undergrad here at U of T, I can vouch for its elegance > and how simple it is to learn initially.... I'd like to suggest that Turing is a much better thought out language than either Pascal or Modula-2. It may look like both of these with a few changes and additions, but the similarities at the syntactic level hide the big advantages of Turing at the semantic level. Take parameter modes. They look just like P/M-2, but there is a big semantic difference. They behave like Ada's IN, IN OUT modes. That is all parameters are transmitted in O(1); the restriction on non-VAR parameters is that the body of the subprogram cannot change them (checked and flagged at compile time). So what's the big difference? Look in a random Pascal book at binary searching of arrays. In 50% of the books you will see the array passed as a non-VAR parameter, which means that it will be copied, which means that the subprogram runs in O(N) not O(Log N) - if the authors implement it recursively, its O(N Log N). Why do authors choose non-VAR, because the array doesn't change. Pascal forces you to choose a mode in an awkward way. What happens in P/M-2 if you accidentally omit VAR. The item is copied, changed internally, and then goes away - causing very strange problems at run time. This cannot happen in Turing; forgetting VAR and trying to change the parameter yields a compile time error. So there is more than meets the eye in Turing. Rich Pattis