LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   TCL - signal command overloaded by Tclx, namespace clash? (https://www.linuxquestions.org/questions/programming-9/tcl-signal-command-overloaded-by-tclx-namespace-clash-4175626774/)

jlinkels 04-01-2018 08:06 AM

TCL - signal command overloaded by Tclx, namespace clash?
 
In some code I have used the signal command. This is from the package Signal. Which works very well, but I believe it is difficult to find and hardly used.

Anyway, I have some code using this signal command. While reusing old code and having the need of including Tclx the signal command cannot be used anymore.

I believe it is overloaded by the signal command from the Tclx package, which has a different syntax:
Code:

% package require Signal
1.4.0.1
% signal add SIGHUP {exit}
% package require Tclx
8.4
% signal add SIGHUP {exit}
command may not be specified for "add" action

The problem is of course that the old code is tested and for the Tclx signal function I'd have to rewrite parts.

This looks like a namespace clash. Unfortunately the signal function from Signal does not seem to have its own namespace.
Code:

% package require Signal
1.4.0.1
% signal add SIGHUP {exit}
% namespace origin signal
::signal

I would have expected to be able to use Signal::signal to call the right function.

Is this a limitation in Tcl? As in Tcl does not support namespaces like Python does?

Is there a solution?

jlinkels


All times are GMT -5. The time now is 09:40 AM.