Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!news.cs.indiana.edu!arizona.edu!arizona!gudeman From: gudeman@cs.arizona.edu (David Gudeman) Newsgroups: comp.lang.misc Subject: definitions Message-ID: <2494@optima.cs.arizona.edu> Date: 26 Apr 91 21:37:28 GMT Article-I.D.: optima.2494 Sender: news@cs.arizona.edu Lines: 68 There seems to be a certain entropy operating in comp.lang.misc: first a lot of the hot air gets generated over misunderstandings because people are using different definitions for terms. Then some definitions get posted and everyone uses the same terminology for a month or so. Then new posters start appearing who haven't seen the original defs and recreate the misunderstandings. This seems to have happened in the typing debates, so I'm going to post definitions again. I've added definitions for binding as well as typing since there seems to have been some confusion over that as well. I for one didn't even know that binding was part of the debate :-). Each definition is given in a formal version, followed by an implementation description for those who don't like formalism. It should be remembered though that the formalism is the definition and the implementation description is only one way (the most common way) to implement the formalism. I've decided to be a little more explicit about the fact that typing refers to machine representations, since that seems to be the major difference between the two extreme views. In other words, if typing only refers to an arbitrary set of values, then most of the differences of opinion disappear. Typing: the machine representation of a value. You must know the typing of a memory location to know how to interpret the bits as a value. Static typing: the assignment of a typing to all the values that a given syntactic expression might produce. This is generally implemented by having the programmer declare the typings of the variables, and then inferring the typing of compound expressions by the types of the operations. Dynamic typing: a programming language feature where the typing of a value can be determined from the value alone, without reference to the way in which the value is used. This is generally implemented by adding a type tag to all values at runtime. Note that since the sizes of values are not known statically, some form of automatic storage management is needed to implement dynamic typing. Strong typing: the feature that an operation cannot return an undefined result because it did not know the typing of one of its operands. Strong static typing is implemented by only allowing operators to be applied to operands whose typing can be statically inferred to be correct for that operator. Strong dynamic typing is implemented by having each operator dynamically check the type tags of its operands to make sure they are correct. Weak typing: the lack of strong typing. Generally, this means that when you call an operation on a value with an unrecognized typing, the operator will return some strange result or core dump. Static binding: the operation represented by a given name or symbol is determined by the program text alone. The simplest way to implement this is to make sure each token represents a unique operation. Some languages allow a token to represent different operations as long as the correct operation can be uniquely determined by considering the static typing. Dynamic binding: the operation represented by a given expression cannot be determined by text alone -- it depends on the execution of the program. Usually the dynamic choice of operation is made based on dynamic typing tags. -- David Gudeman gudeman@cs.arizona.edu noao!arizona!gudeman