Book contents
- Frontmatter
- Contents
- Preface to the Second Edition
- Preface to the First Edition
- Part I Judgments and Rules
- Part II Statics and Dynamics
- Part III Total Functions
- Part IV Finite Data Types
- Part V Types and Propositions
- Part VI Infinite Data Types
- Part VII Variable Types
- Part VIII Partiality and Recursive Types
- Part IX Dynamic Types
- Part X Subtyping
- Part XI Dynamic Dispatch
- Part XII Control Flow
- Part XIII Symbolic Data
- 31 Symbols
- 32 Fluid Binding
- 33 Dynamic Classification
- Part XIV Mutable State
- Part XV Parallelism
- Part XVI Concurrency and Distribution
- Part XVII Modularity
- Part XVIII Equational Reasoning
- Part XIX Appendices
- References
- Index
31 - Symbols
from Part XIII - Symbolic Data
Published online by Cambridge University Press: 05 March 2016
- Frontmatter
- Contents
- Preface to the Second Edition
- Preface to the First Edition
- Part I Judgments and Rules
- Part II Statics and Dynamics
- Part III Total Functions
- Part IV Finite Data Types
- Part V Types and Propositions
- Part VI Infinite Data Types
- Part VII Variable Types
- Part VIII Partiality and Recursive Types
- Part IX Dynamic Types
- Part X Subtyping
- Part XI Dynamic Dispatch
- Part XII Control Flow
- Part XIII Symbolic Data
- 31 Symbols
- 32 Fluid Binding
- 33 Dynamic Classification
- Part XIV Mutable State
- Part XV Parallelism
- Part XVI Concurrency and Distribution
- Part XVII Modularity
- Part XVIII Equational Reasoning
- Part XIX Appendices
- References
- Index
Summary
A symbol is an atomic datum with no internal structure. Whereas a variable is given meaning by substitution, a symbol is given meaning by a family of operations indexed by symbols. A symbol is just a name, or index, for a family of operations. Many different interpretations may be given to symbols according to the operations we choose to consider, giving rise to concepts such as fluid binding, dynamic classification, mutable storage, and communication channels. A type is associated to each symbol whose interpretation depends on the particular application. For example, in the case of mutable storage, the type of a symbol constrains the contents of the cell named by that symbol to values of that type.
In this chapter, we consider two constructs for computing with symbols. The first is a means of declaring new symbols for use within a specified scope. The expression new a ~ ρ in e introduces a “new” symbol a with associated type ρ for use within e. The declared symbol a is “new” in the sense that it is bound by the declaration within e and so may be renamed at will to ensure that it differs from any finite set of active symbols. Whereas the statics determines the scope of a declared symbol, its range of significance, or extent, is determined by the dynamics. There are two different dynamic interpretations of symbols, the scoped and the free (short for scope-free) dynamics. The scoped dynamics limits the extent of the symbol to its scope; the lifetime of the symbol is restricted to the evaluation of its scope. Alternatively, under the free dynamics the extent of a symbol exceeds its scope, extending to the entire computation of which it is a part.We may say that in the free dynamics a symbol “escapes its scope,” but it is more accurate to say that its scope widens to encompass the rest of the computation.
The second construct associated with symbols is the concept of a symbol reference, an expression whose purpose is to refer to a particular symbol. Symbol references are values of a type ρ sym and are written ‘a for some symbol a with associated type ρ. The elimination form for the type ρ sym is a conditional branch that determines whether a symbol reference refers to a statically specified symbol.
- Type
- Chapter
- Information
- Practical Foundations for Programming Languages , pp. 277 - 283Publisher: Cambridge University PressPrint publication year: 2016