swirl
Guide to OmniMark 9   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
Prerequisite Concepts     Related Topics  

Modules, shared

Shared Modules

A module can be imported more than once. If the module is shared, then there will only be a single instance of the imported module, and the code and the data that it defines will be shared by all of the importers. If the module is not shared, then each time it is imported, a separate instance of the code and the data will be created.

Both techniques have their uses:

The sharing/non-sharing distinction is determined by a module definition, not by its importers. You specify that a module is shared by following the keyword module at its head by shared as and a name, as in:

  module shared as com.stilo.math.float
  ; The rest of the floating point math. module.
  ; Shared because it has no local state, and
  ; because the "float" type needs to be common to all uses.

The name specified by shared as must either be a valid OmniMark name or a quoted string.

When a module is shared, the following apply:

Prerequisite Concepts
 
  Related Topics
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:35:14 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.