Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!arizona!gudeman From: gudeman@cs.arizona.edu (David Gudeman) Newsgroups: comp.lang.misc Subject: Re: Dynamic typing -- To Have and Have Not (was Runti Message-ID: <593@optima.cs.arizona.edu> Date: 10 Mar 91 00:21:37 GMT Sender: news@cs.arizona.edu Lines: 48 In article <1991Mar6.024730.19073@engage.enet.dec.com> grier@marx.enet.dec.com writes: ] ] This is besides the point, but what's an untyped language then? The term is usually used to refer to dynamically typed languages. I'd just as soon drop the term completely, since it is misleading if a language has any built-in types at all. ]... Hope, which is strongly typed, ]but where an inference system is used to determine the static typing ]of the dynamically typed expression. ] ] Does this fall into your category? Hope is statically typed since you can give types to syntactic expressions. The definition does not specify how the types are derived (I said types _usually_ determined by declarations). ] It seems to me that with global optimization, you can turn any ]seemingly weakly typed expression into a strongly typed one Do you mean "turn any dynamically typed language into a statically typed one"? If so, it has been my experience that given a program in a dynamically typed language, a human can determine unique types for 85% to 99% of the names in the language. Type inference generally is a little weaker, but is getting pretty good. ] ...the value returned from something like ]"read" *does* fall into some type, and the return should be treated ]by the client as a "refany" is in CLU or Modula-3: you have to apply ]a type-case to the value in order to narrow the type of the ]expression. ] ] Is this contrary to your goals? Yes, it is. I don't want to have to write extra code to express something that should be obvious. If I write "3 + read()" it should be obvious that I want the correct sort of addition to be done depending on whether read() returns an int or a float. I shouldn't have to say it explicitly. Another reason I don't want to write type-case expressions for things like this is that I may later change the definition of read() so that it always returns a float. I don't want to have to go find every place I used it and remove all the type-case stuff. -- David Gudeman gudeman@cs.arizona.edu noao!arizona!gudeman