Lecture overview -- Keyboard shortcut: 'u'  Previous page: Types [Section] -- Keyboard shortcut: 'p'  Next page: Typing and Typecheck -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 1 - Page 9 : 49
Programming Paradigms
Introduction to Functional Programming in Scheme
Types

Types plays an essential role in any programming language and any programming paradigm. In many languages types are used in the program text as constraints on variables and parameters. C, Pascal, and Java are such languages. In others, the types are inferred (somehow extracted from use of variables, parameters etc. relative to the ways the variables and parameters are used in operators and functions). ML is such a language. Yet in other languages, types are solely used to classify the values (data objects) at run time. Scheme is such a language. Thus, in Scheme we do not encounter types in the source program, but only at run time.

Types are used to make programs more readable, make them run more efficient, and to detect certain errors before they cause errors in the calculation.

  • Readability

    • Explicitly typed variables, parameters and function serve as important documentation, which enhances the program understanding.

  • Efficiency

    • Knowledge of the properties of data makes it possible to generate more efficient code

  • Correctness

    • Explicit information about types in a program is a kind of redundancy against which it is possible to check expressions

    • Programmers usually wish to identify type errors as early as possible in the development process