Skip to main content

7 Generic Specifications

  • Chapter

Part of the Lecture Notes in Computer Science book series (LNCS,volume 2900)

Abstract

Making a specification generic (when appropriate) improves its reusability.

As mentioned in the previous chapter, naming specifications is a good idea. In many cases, however, datatypes are naturally generic, having sorts, operations, and/or predicates that are deliberately left loosely specified, to be determined when the datatype is used. For instance, datatypes of lists and sets are generic regarding the sort of elements. Generic specifications allow the genericity of a datatype to be made explicit by declaring parameters when the specification is named: in the case of lists and sets, there is a single parameter that simply declares the sort Elem. A fitting argument specification has to be provided for each parameter of a generic specification whenever it is referenced; this is called instantiation of the generic specification.

The aim of this chapter is to discuss and illustrate how to define generic specifications and instantiate them. We have seen plenty of simple examples of generic specifications and instantiations in the previous chapters. In more complicated cases, however, explicit fitting symbol maps may be required to determine the exact relationship between parameters and arguments in instantiations, and so-called imports should be separated from the bodies of generic specifications.

Keywords

  • Total Order
  • List Length
  • Predicate Symbol
  • Operation Symbol
  • Integer Arithmetic

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Generic specifications are also useful to ensure loose coupling between several named specifications, replacing an explicit extension by a parameter including only the necessary symbols and their required properties. This is illustrated in the Steam-Boiler Control System case study, see Chap. 13.

This is a preview of subscription content, access via your institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • DOI: 10.1007/978-3-540-44397-1_7
  • Chapter length: 16 pages
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
eBook
USD   74.99
Price excludes VAT (USA)
  • ISBN: 978-3-540-44397-1
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
Softcover Book
USD   99.00
Price excludes VAT (USA)

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and Permissions

Copyright information

© 2004 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Bidoit, M., Mosses, P.D. (2004). 7 Generic Specifications. In: Bidoit, M., Mosses, P.D. (eds) CASL User Manual. Lecture Notes in Computer Science, vol 2900. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-44397-1_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-44397-1_7

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-20766-5

  • Online ISBN: 978-3-540-44397-1

  • eBook Packages: Springer Book Archive