dmh_var Tcl Command

NAME

dmh_var - access dmh package variables

SYNOPSIS

dmh_var name1 [name2]

DESCRIPTION

In Tcl version 8.3 and earlier, dmh package variables are in the global namespace.  With later versions of Tcl, the package variables exist in the namespace dmh.  This procedure can be called to return the fully-qualified name of a DMH package variable which can be used to reference a variable without a global or namespace declaration.  The procedure is used to write applications that use the dmh package, and run without change with different versions.  The procedure is included as part of the Hume GEM applications, and Tcl packages that have been built after September, 2002. 

The arguments to the procedure are, name1, a scalar variable name or an array name, and optionally, name2, an array subscript.

For Example:


# used to be global mh_group 
set varname [dmh_var mh_group]
if { [info exists $varname] && [set $varname] != {}} { ... }

# used to be $dmh(notk) where dmh was a global array
set notk_value [set [dmh_var dmh notk]]

Note: the ::dmh::mbx message system command executes whenmsg callback code in the ::dmh namespace at the topmost level of the interpreter.  This means that variable references which are made outside of a procedure call, can refer to ::dmh namespace variables such as $mbxmsg without namespace qualification, and can refer to global variables such as $tcl_version without declaring them global.

AUTHOR

Ed Hume, Hume Integration Software

SEE ALSO

dmh_import global namespace

KEYWORDS

namespace DMH