Imports - lgwagner/SpeAR GitHub Wiki

Imports allow users to import another specification or definitions file into an existing one, so the elements may be reused. Imports can be viewed similarly to the include functionality in the C programming language, or class imports in the Java language. They allow specifications to be built modularly with a focus on enabling reuse when appropriate.

Example

Shown is an example of a specification of a microwave oven. This specification is composed of four sub-specifications:

  • a specification that handles inputs to the keypad and produces outputs used by the mode logic
  • a specification that handles inputs to the model logic and produces outputs to the three-digit display
  • two specifications that turn time into a three-digit display, and vice-versa

This specification also uses a definitions file which is imported as microwave_definitions.spear, in the first import.

Useful Information

  • Definitions files are not allowed to import specifications.
  • If a specification calls another specification, the called specification must first be imported.
  • As long as a file is in the workspace, it may be imported from parent or children directories using standard folder navigation as shown below.
⚠️ **GitHub.com Fallback** ⚠️