Module types, module variables, and their use as a universal encapsulation mechanism

  • Authors:
  • Atanas Radenski

  • Affiliations:
  • Department of Computer Science, P.O.Box 13117, Winston-Salem State University, Winston-Salem, North Carolina

  • Venue:
  • ACM SIGPLAN Notices
  • Year:
  • 1994

Quantified Score

Hi-index 0.00

Visualization

Abstract

The objective of this paper is to develop a universal encapsulation mechanism which can serve as a single substitute for classes, packages, records and subroutines. The proposed mechanism, the module type, is based on a modification of the traditional meaning of the concept of type. A module type defines a collection of entities, such as constants, types, variables, and optionally, a module body. A module type can be used to declare module variables. The body of a module variable can be activated by a module call.It is demonstrated how module types can implement classes, and how module variables can serve the need for packages, subroutines, and records.The concept of module type is embedded in an experimental language whose main features are briefly described in the paper. A prototype compiler for this language has been developed. The implementation scheme is also discussed.Module types and module variables have uncomplicated and intuitively clear semantics. As a result, they are simple to use, and they allow more efficient implementation compared to traditional encapsulation mechanisms.The paper outlines a programming language experiment and is not aimed at a formal theoretical study of module types.