Polymorphic queries across sets, bags, and lists

  • Authors:
  • Limsoon Wong

  • Affiliations:
  • Institute of Systems Science, Heng Mui Keng Terrace, Singapore 0511

  • Venue:
  • ACM SIGPLAN Notices
  • Year:
  • 1995

Quantified Score

Hi-index 0.00

Visualization

Abstract

Bulk data types such as sets, bags, and lists are an important component of a modern query language. It is desirable that operations on one bulk data type (such as sets) that have analogous counterparts in other bulk data types (such as bags and list) be expressed using the same expression. This kind of uniformity is achieved only to a limited degree in object-oriented languages, as these languages have the type information loss problem. Languages based on parametric polymorphism achieve this uniformity in a much better way, but only upto "bracket-switching." That is, in these languages, a query over bags that is analogous to a query over sets, are identical upto interchanging the set and bag brackets. This paper presents a simple extension to a popular parametric polymorphic type system. We show that it is possible to construct a query language around this type system so that the same expression can be used to implement analogous queries across sets, bags, and lists. Furthermore, this uniformity is achieved without any loss in type information.