CSC/ECE 517 Fall 2009/wiki1b 11 al: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 10: Line 10:


===Static Typing===
===Static Typing===
 
Static typing, which dates back to the 1950s, was the first form of typing available. It was extensively used in various compiled and interpreted languages including Ada, C, C++, C#, JADE, Java, Fortran, Haskell, ML, Pascal, Perl  and Scala.
Static Typing performs a one-time evaluation of type information at compile time. This also serves to be a program verification [2] mechanism, wherein, many type errors are caught early in the development cycle. However the number of errors that are caught depends on the strength of the typing system.
Also possible among these are “type inference” algorithms[3], which are used in the newer generations of statically typed languages like ML, C# etc which help in two ways :
*Determine the legal values possible for a variable
*Preventing the occurrence of incompatible values in mathematical expressions
Thus, this type is a typical guide to the compiler on how much storage needs to be allocated to a variable.


===Dynamic Typing===
===Dynamic Typing===

Revision as of 16:33, 21 September 2009

Overview

Static languages are known for its conservative approach to language processing, making most typing decisions at compile time itself thereby allowing the compilers to optimize on the byte code generated and provide better type-error checking. Thus, performance is tweaked in these languages. Dynamic languages, on the other hand, attempt to improve the productivity of the average developer, allowing him more flexibility in terms of type checking and so, delay most typing decisions as much as feasible. Thus they sacrifice slightly on performance, and allow for more expressiveness and freedom.

Type Systems

Type System is defined formally as

"A tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according to the kinds of values they compute."[1]

The study of type systems is called Type Theory and has a significant role in Computer Language Design, apart from Computer Architecture, Compiler Construction and study of Grammars. Simplistically viewed, a Type System provides an abstraction to a collection of bits. All data to a computer is sequence of bits. The hardware is incapable to segregating or separating them into memory addresses, instruction code, characters, integers and floating-point numbers, since all it sees is the bit stream. However, any application makes references to its available memory within the program, as variables. Type system provides the necessary abstraction to programmers, offering them a higher level, modular view at the implementation, by, for example, allowing them to think of strings as a char collection, rather than a stream of bytes.

Static Typing

Static typing, which dates back to the 1950s, was the first form of typing available. It was extensively used in various compiled and interpreted languages including Ada, C, C++, C#, JADE, Java, Fortran, Haskell, ML, Pascal, Perl and Scala. Static Typing performs a one-time evaluation of type information at compile time. This also serves to be a program verification [2] mechanism, wherein, many type errors are caught early in the development cycle. However the number of errors that are caught depends on the strength of the typing system. Also possible among these are “type inference” algorithms[3], which are used in the newer generations of statically typed languages like ML, C# etc which help in two ways :

  • Determine the legal values possible for a variable
  • Preventing the occurrence of incompatible values in mathematical expressions

Thus, this type is a typical guide to the compiler on how much storage needs to be allocated to a variable.

Dynamic Typing

Performance Comparison

Optimizations to Dynamic Languages

Case Studies

Conclusion

See Also

References