Version 7 of overload

Updated 2005-12-27 02:40:44

[General meaning in software]

[much used in Tcl]

In Tcl, to enhance a core command (or existing proc) by renaming the command to be enhanced, then creating a procedure with the same name as the core command that provides the desired functionality.

Easy example, provided by RS:

    rename exit _exit

    proc exit {{code 0}} {
        set fp [open test a]
        puts $fp "trapped exit at [clock format [clock seconds]]"
        _exit $code
    }

[General case needs uplevel ...]


Category Development