Rob Thorpe wrote: > Chris Smith wrote: > > Torben Ægidius Mogensen <[EMAIL PROTECTED]> wrote: > > > That's not really the difference between static and dynamic typing. > > > Static typing means that there exist a typing at compile-time that > > > guarantess against run-time type violations. Dynamic typing means > > > that such violations are detected at run-time. This is orthogonal to > > > strong versus weak typing, which is about whether such violations are > > > detected at all. The archetypal weakly typed language is machine code > > > -- you can happily load a floating point value from memory, add it to > > > a string pointer and jump to the resulting value. ML and Scheme are > > > both strongly typed, but one is statically typed and the other > > > dynamically typed. > > > > Knowing that it'll cause a lot of strenuous objection, I'll nevertheless > > interject my plea not to abuse the word "type" with a phrase like > > "dynamically typed". If anyone considers "untyped" to be perjorative, > > as some people apparently do, then I'll note that another common term is > > "type-free," which is marketing-approved but doesn't carry the > > misleading connotations of "dynamically typed." We are quickly losing > > any rational meaning whatsoever to the word "type," and that's quite a > > shame. > > I don't think dynamic typing is that nebulous. I remember this being > discussed elsewhere some time ago, I'll post the same reply I did then > .. > A language is statically typed if a variable has a property - called > it's type - attached to it, and given it's type it can only represent > values defined by a certain class. > > A language is latently typed if a value has a property - called it's > type - attached to it, and given it's type it can only represent values > defined by a certain class. > > Some people use dynamic typing as a word for latent typing, others use > it to mean something slightly different. But for most purposes the > definition above works for dynamic typing also. > > Untyped and type-free mean something else: they mean no type checking > is done.
Since people have found some holes in this definition I'll have another go:- Firstly, a definition, General expression (gexpr) are variables (mutable or immutable), expressions and the entities functions return. A statically typed language has a parameter associated with each gexpr called it's type. The code may test the type of a gexpr. The language will check if the gexprs of an operator/function have types that match what is required, to some criteria of sufficiency. It will emit an error/warning when they don't. It will do so universally. A latently typed language has a parameter associated with each value called it's type. The code may test the type of a value. The language may check if the gexprs of an operator/function have types that match what is required, to some criteria of sufficiency. It will not necessarily do so universally. An untyped language is one that does not possess either a static or latent type system. In an untyped language gexprs possess no type information, and neither do values. -- These definitions still have problems, they don't say anything about languages that sit between the various categories for example. I don't know where HM type system would come in them. -- http://mail.python.org/mailman/listinfo/python-list