Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!rpi!bu.edu!m2c!umvlsi!dime!yodaiken From: yodaiken@chelm.cs.umass.edu (victor yodaiken) Newsgroups: comp.lang.misc Subject: Re: Dynamic typing (part 3) Message-ID: <28875@dime.cs.umass.edu> Date: 5 Apr 91 15:01:14 GMT References: <1991Apr1.010526.26781@neon.Stanford.EDU> <1APR91.23564447@uc780.umd.edu> <28673@dime.cs.umass.edu> <3APR91.00020019@uc780.umd.edu> <28742@dime.cs.umass.edu> <3APR91.20574161@uc780.umd.edu> Sender: news@dime.cs.umass.edu Reply-To: yodaiken@chelm.cs.umass.edu (victor yodaiken) Organization: University of Massachusetts, Amherst Lines: 47 In article <3APR91.20574161@uc780.umd.edu> cs450a03@uc780.umd.edu writes: >Victor Yodaiken > > [responding to an illustration of how constructing a function > specifies the type of the function] >>This makes sense, but it seems to be an instance of an abbreviation >>or convention. There is a preface: all functions are asumed to be >>over balogna sandwiches, implied in what you write. If what you mean >>by "dynamic typing" is simply greater facility in defining domains >>and higher level declarations of type (e.g., all functions in the >>block are over integers), then I believe that I understand. But, it >>appeared from earlier discussion that dynamic typing was more >>involved. > >Dynamic typing is simple in *concept*. The problem is that it often >does not map well onto machine architecture. For example, if you have >a function which is defined over the domain of numbers (take addition, >for example), then you usually see a dynamic typing system faithfully >providing that functionality for a variety of machine implementations >of numeric types. > Your explanation is confusing me even more. Most of the programming languages that I know do something like this. For example, x +y works fine in "C" for floating and integer types, and can also be extended to other types in C++ I believe. Maybe a precise definition of "dynamic typing" would be useful. From previous postings, I had the impression that "dynamic typing" involved compiler/run-time inferences about the type of a function or variable from the context and use of the variable or function. On the other hand, "static typing" requires the programmer to indicate exactly the type of the object. Is this incorrect? >In a statically typed language, type is considered to be a property of >variables, so if a variable can have a value outside the domain of a >function then that is not considered a type error. In a dynamically >typed language, where practically all functions have type checks to >ensure their arguments' validity, more is usually checked than just >the "wordsize" or the "typetag" of the arguments. > Again, I'm not following you here. Is this extra type checking in dynamic languages part of the language or a coding style? Clearly there are limits to how much the compiler can do: e.g. x * limit(f,x, x-> 0) is a "type" error of some kind if f(x) does not converge --- multiplication has only numbers in its domain.