Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!elroy.jpl.nasa.gov!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!warwick!nott-cs!piaggio!anw From: anw@maths.nott.ac.uk (Dr A. N. Walker) Newsgroups: comp.lang.misc Subject: Re: Dynamic typing (part 3) Message-ID: <1991Mar20.185308.8275@maths.nott.ac.uk> Date: 20 Mar 91 18:53:08 GMT References: <731@optima.cs.arizona.edu> Reply-To: anw@maths.nott.ac.uk (Dr A. N. Walker) Organization: Maths Dept., Nott'm Univ., UK. Lines: 71 In article <731@optima.cs.arizona.edu> gudeman@cs.arizona.edu (David Gudeman) writes: >In article <1991Mar14.151707.11686@maths.nott.ac.uk> Dr A. N. Walker writes: [I assumed that "Algol", in DG's bracketing of Algol and Fortran as low-level languages, meant Algol 60] >No, I was refering to the earliest Algol tradition. Have you actually *read* the Algol 58 (or IAL) report? The Algol tradition is of a patrician disregard for efficiency, which argues against your assertions that various features were put in to make code generation easier. As late as Algol 68, the arguments are mostly about whether things can, *in principle*, be compiled; it was assumed, as a matter of faith, that compiler technology would eventually catch up. [re Fortran] >I said "static typing", not "type declarations". Early FORTRAN had >static typing but some of the declarations were implicit. Just so. This saves the "busy work" to which you objected; nevertheless, reputable authors recommend that Fortran users should put the busy work back in. >You are just arguing for array bounds checking -- arguably a form of >dynamic typing. Semantics. It's not what most people think of as dynamic typing, and it exists in Algol N (for all N!), Pascal, C, Fortran, etc., which you surely don't think of as dynamically typed languages. [Static typing has two] >]>consequences: (1) you have to limit the forms of expressions to some >]>set for which you know a type-checking decision procedure, and (2) you >]>have to acquire type information somewhere. > >] Ie, (1) you have to know what your expression is intended to do, >]and (2) you have to use variables in a disciplined way. > >Your (1) is meaningless. Of course you have to know what an >expression is intended to do in any language. This has nothing to do >with when type checking is done. If *I* can look at (say) "a+b" and decide whether the operation is defined, and what types the operands might have, and what the consequences might be for the rest of the program, so can the compiler. If you intend to make use of the *freedom* that dynamic typing can give you [and I agree that it is sometimes, even often, useful], then it follows that you *can't* know what your expression might do (except in the very boring sense that a particular language might define otherwise undefined operations to deliver 0, or some such). > Your (2) is a subjective judgement [...] Certainly. On the other hand, if writing out each identifier that you use just once extra, with [usually] one word and a semicolon, is a significant load in a serious production program, there's something wrong somewhere. Of course there are times when it's a nuisance; there are times when *any* form of documentation or commenting is a nuisance. >] There is a place for dynamic typing (I enjoy writing shell >]scripts!), and a case for rapid prototyping, [...] > >In the first place, dynamic typing is useful for full-scale working >programs, not just prototypes. I did distinguish the two! -- Andy Walker, Maths Dept., Nott'm Univ., UK. anw@maths.nott.ac.uk