Lecture overview -- Keyboard shortcut: 'u'  Previous page: Types -- Keyboard shortcut: 'p'  Next page: Static type checking -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home    Lecture 2 - Page 13 : 46
Functional Programming in Scheme
Expressions, Types, and Functions
Type checking

As already mentioned the use of types in source programs makes it possible to deal with program correctness - at least in some simple sense. In this context, correctness is not relative to the overall intention or specification of the program. Rather, it is in relation to the legal use of values as input to operators and functions.

Type checking is the processes of identifying errors in a program based on explicitly or implicitly stated type information

  • Weak typing

    • Type errors can lead to erroneous calculations

  • Strong typing

    • Type errors cannot cause erroneous calculations

    • The type check is done at compile time or run time

According to section 1.1 the Scheme Report (R5RS) 'Scheme has latent as opposed to manifest types. Types are associated with values (also called objects) rather than with variables.' In our categorization, Scheme is strongly typed and types are dealt with at run time (on values) as a contrast to compile time (on variables).

  • Static typing

    • The types of all expressions are determined before the program is executed

    • The type check is typically carried out in an early phase of the compilation

    • Comes in two flavors: explicit type decoration and implicit type inference

    • Static typing implies strong typing