ScienceDirect® Home Skip Main Navigation Links
You have guest access to ScienceDirect. Find out more.
 
Home
Browse
My Settings
Alerts
Help
 Quick Search
 Search tips (Opens new window)
    Clear all fields    
advertisementadvertisement
Theoretical Computer Science
Volume 275, Issues 1-2, 28 March 2002, Pages 215-258
 
Font Size: Decrease Font Size  Increase Font Size
 Abstract - selected
Purchase PDF (290 K)

 
 
 
Related Articles in ScienceDirect
There are no related articles for this article.
 
View Record in Scopus
 
doi:10.1016/S0304-3975(01)00129-3    How to Cite or Link Using DOI (Opens New Window)
Copyright © 2002 Elsevier Science B.V. All rights reserved.

Open and closed scopes for constrained genericity

Dominic DugganCorresponding Author Contact Information, E-mail The Corresponding Author, a and John Ophelb

a Department of Computer Science, Stevens Institute of Technology, Hoboken, NJ 07030, USA b Department of Computer Science and Computer Engineering, La Trobe University, Bundoora, Vict. 3083, Australia

Received 15 April 1997;
revised 5 January 2001;
accepted 7 February 2001.
Communicated by J. Staples.
Available online 23 March 2002.

Purchase the full-text article



References and further reading may be available for this article. To view references and further reading you must purchase this article.

Abstract

Constrained genericity is an extension of parametric polymorphism, that allows type parameters in polymorphic procedures to be constrained to have certain operations defined over them. It is realized in the Ada and Haskell programming languages, as exemplified by type classes in Haskell. Type classes only allow a single global scope for instances of type classes. This article introduces a type system and a semantics that allows both dynamic and static scoping of such operations to be mixed in a program. Applications include overcoming scoping problems with constrained genericity, enabling program optimizations, and programming with dynamic data structures. Type classes with “open” scope obey the usual semantics for Haskell type classes, based on call-site “type dictionaries”. Type classes with “closed” scope use run-time type descriptions to dispatch to instances. The type system to support this combines operator kinds, refinement kinds and singleton kinds. The system is extended to allow overlapping specialized instance types, in order to support specialized representations for data structures (for example, arrays of integers, arrays of floats and arrays of boxed values). This extension requires the combination of both type dictionaries and run-time type information for type class dispatching.

Author Keywords: Constrained genericity; Refinement kinds; Type classes; Dynamic type dispatch


 
Home
Browse
My Settings
Alerts
Help
Elsevier.com (Opens new window)
About ScienceDirect  |  Contact Us  |  Information for Advertisers  |  Terms & Conditions  |  Privacy Policy
Copyright © 2008 Elsevier B.V. All rights reserved. ScienceDirect® is a registered trademark of Elsevier B.V.