SKILL++ Modules#
Virtue SKILL++ modules ares SKILL tables that organize closely related code without defining any global symbols. They allow it to share private functions and variables between functions and avoid name collisions between modules. Modules can then be imported into a local lexical SKILL++ environment from the module Import table without affecting the top-level environment. A module is saved as a table but can be created as a DPL or a table.
Import a Module#
A module can be imported into the lexical environment of a SKILL++ let statement by defining a local variable to a module from the Package Import table.
Define a DPL Module#
A module can be created as a decomposed property list (DPL), similar to the “SKILL++ packages” defined in the user manual. Public functions are defined as part of the DPL property list. Private module variables are defined in the variable list of the named let function. Functions defined within the package’s let statement but aren’t in the DPL property list are local. The public variables of the DPL are added to the module’s table.
example:
Lcv.ils SKILL++ Module
1let((Lcv
2 (module_description
3 "Select the lib, cell, view or history name from an ordered list of them.")
4 )
5Lcv = let(()
6
7procedure(lib(lcv_list "l")
8 "Get the library name frim a lcv (lib, cell, view) list"
9 car(lcv_list)
10)
11procedure(cell(lcv_list "l")
12 "Get the cell name frim a lcv (lib, cell, view) list"
13 cadr(lcv_list)
14)
15
16procedure(view(lcv_list "l")
17 "Get the view name frim a lcv (lib, cell, view) list"
18 caddr(lcv_list)
19)
20
21procedure(history(lcvh_list "l")
22 "Get the history name frim a lcvh (lib, cell, view, history) list"
23 cadddr(lcvh_list)
24)
25
26list(nil
27 'lib lib
28 'cell cell
29 'view view
30 'history history
31))
32
33Import['Module]->New('Lcv
34 ?module Lcv
35 ?package Import['Virtue]
36 ?description module_description)
37)