Re: After I overload "switch" command, how can I get back the original "switch" function back?



pheobe wrote:
I am planning to overlad "switch" command in my application, and use
it do something, yet after that, how can I get back the original
function of "switch" ? I don't want to use the overlad "switch" all
through my appliction. Any body can help me?

Write your own [switch] command in your own namespace:

namespace eval pheobe {
namespace export switch
proc switch args {...}
}

Use [namespace import ::pheobe::switch] to bring it into other
namespaces where you want to use it.

In any namespace where you have your [switch] imported, but you want to use Tcl's built-in [switch] command, access it via the fully qualified command name [::switch].

Please completely ignore anyone recommending [rename] as an answer to your question. They are still living in Tcl 7 land (aka 1997).

--
| Don Porter Mathematical and Computational Sciences Division |
| donald.porter@xxxxxxxx Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
.



Relevant Pages

  • Re: Decision Tables
    ... namespace parser{ ... switch ){ ... bool b = expr; ... "See source grammar for query syntax\n" ...
    (comp.programming)
  • Re: Tcl Switch case
    ... Going back to the 'mess' which is switch. ... a unique command in several ways. ... The nocase variety does the same thing in the::myswitchnc namespace. ...
    (comp.lang.tcl)
  • Re: SET_PERSONALITY and TASK_SIZE
    ... for the interpreter happens in the namespace of the ... SET_PERSONALITY is NOT allowed to switch ... 'extra' bits is set we may incorrectly set personality to PER_LINUX even ...
    (Linux-Kernel)
  • Re: using /namespace with tlbimp.
    ... I want some information regarding /namespace switch. ... Namespace of the source code where our COM dll is referenced for which we ... Using the tlbimp /namespace switch, you can control the namespace in which ... the interop typeinfo is generated. ...
    (microsoft.public.dotnet.framework)
  • Re: After I overload "switch" command, how can I get back the original "switch" function back?
    ... before creating the replacement procedure. ... rename switch switch_savedForLaterByPheobe ... If the code that is using your modified is in a namespace other ... # Invoke command that uses the custom ...
    (comp.lang.tcl)