Article View: comp.lang.misc
Article #6204Re: Turing programming language.
From: Mark Mendell
Date: Fri, 20 Jan 1989 16:09
Date: Fri, 20 Jan 1989 16:09
74 lines
2777 bytes
2777 bytes
I would like to know what you don't like about the syntax of Turing. I admit
that as the main Turing development person, I am biased, but I like the Turing
syntax.
You give two examples of features that you don't like:
"I especially hate the very ugly loop statement"
"And what about the cumbersome linked list example on page 1415."
I think that loop statement in Turing is simple and easy to use. It is more
powerful than the equivalent Pascal loops. For example:
(Please forgive minor Pascal syntax errors)
Pascal Turing
while condition do loop
begin exit when not condition
... code ... ... code ...
end end loop
repeat loop
... code ... ... code ...
until condition exit when condition
end loop
{ the one and a half loop } /* the one and a half loop */
read (i) loop
while i <> 0 do get i
begin exit when i = 0
.... code ... ... code ...
read (i) end loop
end
As you can see, in Pascal, you have to repeat the 'read(i)' at the bottom of
the loop. This can lead to problems maintaing the program, if only one of
the lines are ever changed. In turing, there is only one copy of this code.
You have a better point with collections. The Turing syntax:
var symbolEntry : collection of
record
name : string
location : int
/* ... more fields ... */
next : pointer to symbolEntry
end record
type SymbolPtr : pointer to symbolEntry
var sym : SymbolPtr
new symbolEntry, sym /* == sym = (symbolEntry *) malloc (sz); */
symbolEntry (sym).name := "fubar"
symbolEntry (sym).next := nil(symbolEntry)
The 'collectionName(pointer)' syntax is more wordy than C or Pascal. On the
other hand, it does tell you explicitly what the pointer points to. In
addition, the syntax is deliberately identical to array subscripting. This
is because the formal proof rules consider collection elements to be the same
as array elements. A collection is just an array that can grow and shrink
using 'new' and 'free'
--
Mark Mendell
Computer Systems Research Institute University of Toronto
Usenet: {linus, ihnp4, allegra, decvax, floyd}!utcsri!mendell
Internet: mendell@turing.toronto.edu
mendell@turing.utoronto.ca
Technical Details
Message-ID:
<89Jan20.111000est.4328@turing.toronto.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!turing.toronto.edu!mendellReferences:
<11@euteal.UUCP>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.misc Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!turing.toronto.edu!mendell From: mendell@turing.toronto.edu (Mark Mendell) Subject: Re: Turing programming language. Message-ID: <89Jan20.111000est.4328@turing.toronto.edu> Keywords: programming language Organization: CSRI, University of Toronto References: <11@euteal.UUCP> Date: Fri, 20 Jan 89 11:09:55 EST