dmh_import Tcl Command

NAME

dmh_import - import dmh package commands into the global namespace

SYNOPSIS

dmh_import {want_old_lset 0}

DESCRIPTION

If needed, import dmh package commands into the global namespace so that applications work with the new or the older Tcl versions.

With Tcl version, 8.4, the command lset became a core command of Tcl, which conflicted with a dmh package command of the same name.  The name conflict with the dmh package was the motivation to cleanup the dmh package by moving commands and variables into the namespace dmh. New applications can choose which package commands to import into the global namespace, so future conflicts are avoidable.

As detailed below, most existing applications will run without change after calling dmh_import. It is ok to call dmh_import when using Tcl 8.3, and this is the supported and proper way to code applications to run with both Tcl 8.3 and 8.4+.

To run Tcl 8.3 dmh package applications with Tcl 8.4+, you need to:

  1. Call dmh_import and optionally restore the old dmh package lset command.

    If you restore the old lset you will not be able to use the new core lset command, but you may skip the next step.

    The Hume SECS/GEM applications call dmh_import without restoring the old lset. If you have custom SECS/GEM application code that uses lset, in order to run with Tcl 8.4+, you need to either revise the lset usages to vset, or customize your application startup to call dmh_import with the lset restore option set to 1.  You do not need to change your custom SECS/GEM code to continue running on Tcl 8.3 with or without the latest dmh package or GEM application changes.

  2. If you did not restore the old lset, then replace usage of lset with vset, and have the file vset.tcl as part of your auto_load library. The file vset.tcl is part of Tcl 8.3.3 dmh package libraries, and part of the GEM application library for builds after September, 2002. The logic in vset.tcl lets you use the vset command with Tcl 8.3 and earlier. This is the proper and supported way to have an application that can run with the older and newer Tcl versions, and can use the new core lset command when running in Tcl 8.4+.

  3. Replace any access to dmh package global variables such as mh_group, SQL(), or dmh() with access using the dmh_var procedure.  You do not need to change references to mbxmsg, mbxreply, or mbxdest that occur in mbx whenmsg Tcl logic outside of procedures.  The mbx whenmsg logic is executed in the ::dmh namespace so these references are found.  If you reference mbxmsg, mbxreply, or mbxdest from inside of a procedure, they are no longer global, and using dmh_var is recommended.  The GEM application code has examples of using dmh_var.  The dmh_var.tcl file has been made part of the Tcl 8.3.3 dmh package library, and the GEM application library for builds after September, 2002, so that you can revise applications to be compatible with Tcl 8.3 and 8.4+.

AUTHOR

Ed Hume, Hume Integration Software

SEE ALSO

dmh_var global namespace

KEYWORDS

DMH dmh_import namespace