CSC/ECE 517 Fall 2009/wiki1b 2 ps: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:


== Typed and Untyped languages ==
== Typed and Untyped languages ==
The “type” provides the information about the chunk of memory which holds the data and thus categorizes it such that the valid operations that can be performed on that data are defined. In object-oriented programming, the types include classes (user-defined), strings and integers (primitive types), lists/arrays/vectors/hash (containers) [2]. A variable in a program can accept a certain range of values during its execution. The upper bound value for that range marks the type for that particular variable. For example, if there is a variable num of type int in the program then num can accept only integer values during every execution of the program. Such languages where all the variables are associated with the data type are called typed languages. Certain languages do not specify separate data types for each of the variables but contains a single universal type that holds all the values. They do not define the range for the variables and are called untyped languages (assembly languages) [4].
The “type” provides the information about the chunk of memory which holds the data and thus categorizes it such that the valid operations that can be performed on that data are defined. In [http://en.wikipedia.org/wiki/Object-oriented_programming object-oriented programming], the types include [http://en.wikipedia.org/wiki/Class_(computer_science) classes] (user-defined), strings and integers ([http://en.wikipedia.org/wiki/Primitive_types primitive types]), lists/arrays/vectors/hash ([http://en.wikipedia.org/wiki/Container_(data_structure) containers]) [2]. A variable in a program can accept a certain range of values during its execution. The upper bound value for that range marks the type for that particular variable. For example, if there is a variable ''num'' of type ''int'' in the program then ''num'' can accept only integer values during every execution of the program. Such languages where all the variables are associated with the data type are called [http://en.wikipedia.org/wiki/Programming_language#Typed_versus_untyped_languages typed languages]. Certain languages do not specify separate data types for each of the variables but contains a single universal type that holds all the values. They do not define the range for the variables and are called [http://en.wikipedia.org/wiki/Programming_language#Typed_versus_untyped_languages untyped languages] ([http://en.wikipedia.org/wiki/Assembly_language assembly languages]) [4].
== Type Checking ==
== Type Checking ==
== Statically typed languages ==
== Statically typed languages ==

Revision as of 05:26, 21 September 2009

Advantages of statically typed vs. dynamically typed languages

Type checking can be performed in programming languages either during run-time or at compile time[1]. Based on such a behavior of the type system, the programming languages are classified as statically typed or dynamically typed. The statically typed languages like C, C++, C#, Java, FORTRAN etc., eliminate the type checks to be performed every time the program is executed [1]. The condition checked once will hold good for all the future executions of the program as well. The dynamically typed languages like PHP, Prolog, Python, Ruby, Smalltalk etc., perform the run-time checks uses the information from the compile time as well and hence could be more comprehensive[1].

Typed and Untyped languages

The “type” provides the information about the chunk of memory which holds the data and thus categorizes it such that the valid operations that can be performed on that data are defined. In object-oriented programming, the types include classes (user-defined), strings and integers (primitive types), lists/arrays/vectors/hash (containers) [2]. A variable in a program can accept a certain range of values during its execution. The upper bound value for that range marks the type for that particular variable. For example, if there is a variable num of type int in the program then num can accept only integer values during every execution of the program. Such languages where all the variables are associated with the data type are called typed languages. Certain languages do not specify separate data types for each of the variables but contains a single universal type that holds all the values. They do not define the range for the variables and are called untyped languages (assembly languages) [4].

Type Checking

Statically typed languages

Advantages and Disadvantages

Dynamically typed languages

Advantages and Disadvantages

Comparison of statically typed and dynamically typed languages

References

[1] http://en.wikipedia.org/wiki/Type_system#Type_checking
[2] http://www.artima.com/weblogs/viewpost.jsp?thread=7590
[3] http://www.cs.aau.dk/~normark/prog3-03/html/notes/fu-intr-1-show-types-and-check-1.html
[4] http://www.eecs.umich.edu/~bchandra/courses/papers/Cardelli_Types.pdf