Chapter 9

Data Abstraction

Reimplementing [familiar] algorithms and data structures i n a significantly different language often is an aid to understanding of basic data structure and algorithm concepts.

— Jeffrey D. Ullman, Elements of ML Programming (1997)

Type systems support data abstraction and, in particular, the definition of user-defined data types that have the properties and behavior of primitive types. We discuss a variety of aggregate and inductive data types and the type systems through which they are constructed in this chapter. A type system of a programming language includes the mechanism for creating new data types from existing types. A type system should support the creation of new data types easily and flexibly. We also introduce variant records and abstract syntax, which are of particular use in data structures for representing computer programs. Armed with an understanding of how new types are constructed, we introduce data abstraction, which involves factoring the conception and use of a data structure into an interface, implementation, and application. The implementation is hidden from the application such that a variety of representations can be used for the data structure in the implementation without requiring changes to the application since both conform to the interface. A data structure created in this way is called an abstract data type. We discuss a variety of representation strategies for data structures, including abstract syntax and closure representations. This chapter prepares us for designing efficacious and efficient data structures for the interpreters we build in Part III of this text (Chapters 1012).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.253.223