CP2003 - Type Checking and Expressions

These lecture notes are based on chapter 2 in ``Programming Language Concepts and Paradigms'' by David Watt.

Strings

Although strings are supported by all modern programming languages, there is no consensus on how strings should be handled. There are a number of options:

Type Checking

Why bother with type checking?

When are types checked?

How are types checked - What is type equivalence?

There are two categories of type equivalence:

Type Completeness

There is a principle which exists in the study of types and values called the type completeness principle. This states that no operation should be arbitrarily restricted in the types of values it takes or returns.

Why? Arbitrary restrictions tend to reduce the expressive power of a programming languages. For example, Pascal functions cannot return a string, set or record. This is a violation of the type completeness principle and causes problems if you need to return these values.


Copyright © 1998. Alan McCabe. All rights reserved.