[[Documentation]]

*Modules

This section is subject to modification.

**Name Spaces

A single-level global name space is available for the names of atoms. An atom name p can be qualified with a module name m. The resulting qualified atom name m.p can be used globally.
A single-level global name space is available for the names of atoms. An atom name p can be qualified with a module name m. The resulting qualified atom name m.p can be referred to globally.

Currently, no syntax exist to prohibit a programmer from writing arbitrary qualified names, and, moreover, no syntax exist to abbreviate the module name part of 'exported' names.
Currently, no syntax exists to prohibit a programmer from writing arbitrary qualified names, and, moreover, no syntax exists to abbreviate the module name part of 'exported' names.

**Compile-Time Module Loading

***Syntax

 Definition
    modulename : { Process } 
 Use
    modulename.Atom 
    modulename.Atom or modulename : Atom

Membranes with a module use statically incorporate the rules in Process specified in the corresponding module definition.
Membranes that contain module uses will be supplied
with the copies of the rules
specified in the corresponding module definitions.

***Example

 acc:{ acc:add(A),   acc:value(N) :- acc:value(A+N).
      acc:get(Res), acc:value(N) :- int(N) | Res=N, acc:value(N).
      acc.new                    :- acc.value(0) }.
 { acc:new, acc.add(3), acc.add(4), acc.get(N) }

**Link-Time Module Loading

Link-time module lookup is performed when the source file does not contain the definition of a referred module. When module m is needed to be looked up, the file ${LMNTAL_ROOT}/lmntal_lib/m.lmn is loaded, compiled and linked before the execution of the user program starts, where ${LMNTAL_ROOT} is the directory lmntal.jar is located at.
Link-time module lookup is performed when the source file does not contain the definition of a referred module. When module m needs to be looked up, the file ${LMNTAL_ROOT}/lmntal_lib/m.lmn is loaded, compiled and linked before the execution of the user program starts, where ${LMNTAL_ROOT} is the directory lmntal.jar is located at.


Front page List of pages Search Recent changes Backup   Help   RSS of recent changes