Mod /
Home Page
Search:  


Table Of Contents (show)

  1. 1. Mod

1.  Mod

Mod is a package that simplifies Tcl development. It is a collection of several components such as Tod, Opts option parsing, and navigable backtraces. It also contains XTL and other components still under development.

A primary function of Mod is implementing refactoring for Tcl subcommands and simplifying namespace use through support of modules. A namespace becomes a module simply by using the [Mod export] statement. [Mod export] creates a command for delegating calls to (exported) sub-commands in a namespace. Ensembles (new in Tcl 8.5) are used if available, or otherwise emulated.

A key feature of Mod is the implementation of Autoimport to provide dynamic binding of sub-commands in well-known namespaces, and to enable uses.

Other helpers include [Mod files] which ensures all required packages (including Extern include files if any) get loaded. The main implementation file can be identified by using the [Mod main] call.

Here is an example module:

  package require Mod
  namespace eval foo {
     Mod export
     proc p1 {n}  {return 1}
  }

Mod simplifies packaging of Tcl namespace into modules. It is the central glue used in integrating the Ted/TDB and THT applications.

© 2008 Peter MacDonald

Page last modified on June 06, 2009, at 06:15 PM