Some remarks on records with variants

  • Authors:
  • Wolfgang Hoyer

  • Affiliations:
  • Siemens AG, ZTI SOF 2, D-8000 München 83, Federal Republic of Germany

  • Venue:
  • ACM SIGPLAN Notices
  • Year:
  • 1984

Quantified Score

Hi-index 0.00

Visualization

Abstract

In programming practice it is often necessary to subsume records of different types under one common type such as an array, a file or a linked list. One has only to think of differently formatted records in a personnel file or of entries in a compiler's symbol table. Ever since PASCAL, records with variants constitute the most suitable language constructs available for this purpose.The problem of accessing record components within variants has not been satisfactorily solved by today's languages in two respects. In the first place uniqueness is demanded for the component names across all record variants, and this leads to an unnatural denotation in many cases. Secondly, there is no guarantee at compile time that access to a record variant will not result in a runtime error.In the present paper, ways of avoiding these problems are proposed.