Stub Language

February 28, 2022 ยท View on GitHub

The stub language is the part of the Simple-ML DSL that is used to integrate functions written in Python into Simple-ML. It describes which functionality that is implemented in Python should be publicly available and how it must be used. If do not want to make functionality that exists in Python accessible in Simple-ML, simply do not write stubs for them. The stub language has the following concepts:

  • Packages help avoid conflicts that could arise if two declarations have the same name.
  • Imports make declarations in other packages accessible.
  • Classes define custom datatypes that bundle data and operations on this data.
  • Global Functions define operations that do not belong to a specific class.
  • Enumerations define custom datatypes with a fixed set of possible variants.
  • Annotations attach additional metainformation to declarations.
  • Comments document the code.

Files that use the stub language must have the extension .smlstub.