1. Interfacing Concepts: Why Declaration Style Shouldn't Matter.
- Author
-
Bagge, Anya Helene and Haveraaen, Magne
- Subjects
COMPUTER interfaces ,SORTING (Electronic computers) ,AXIOMS ,MATHEMATICAL analysis ,COMPUTER programming ,IMPERATIVE programming ,FUNCTIONAL programming (Computer science) - Abstract
Abstract: A concept (or signature) describes the interface of a set of abstract types by listing the operations that should be supported for those types. When implementing a generic operation, such as sorting, we may then specify requirements such as “elements must be comparable” by requiring that the element type models the Comparable concept. We may also use axioms to describe behaviour that should be common to all models of a concept. However, the operations specified by the concept are not always the ones that are best suited for the implementation. For example, numbers and matrices may both be addable, but adding two numbers is conveniently done by using a return value, whereas adding a sparse and a dense matrix is probably best achieved by modifying the dense matrix. In both cases, though, we may want to pretend we''re using a simple function with a return value, as this most closely matches the notation we know from mathematics. This paper presents two simple concepts to break the notational tie between implementation and use of an operation: functionalisation, which derives a set of canonical pure functions from a procedure; and mutification, which translates calls using the functionalised declarations into calls to the implemented procedure. [Copyright &y& Elsevier]
- Published
- 2010
- Full Text
- View/download PDF