swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
Prerequisite Concepts     Related Syntax  

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 nameor a quoted string.

When a module is shared, the following apply:

Prerequisite Concepts
   Modules
 
  Related Syntax
   export, export as opaque
   import, supply, prefixed by, unprefixed, use
   module
 
 

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

OmniMark 8.2.0 Documentation Generated: March 13, 2008 at 3:25:49 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2008.