tcl - 检查 TCL 中的对象是否存在

标签 tcl itcl

我想检查 tcl 中是否存在对象。 我查看了 info object 选项,但没有找到特定于对象存在的内容,并且 info contains 仅适用于变量,不适用于对象。

有什么想法吗? 我创建了一个 struct::stack 对象 ::struct::stack aa (Dcode) 52 % 信息对象类 aa ::结构::堆栈::stack_oo

好像是在tcloo。 我认为在 Itcl find 命令中可以工作 itcl::find object aa

但不知道 tcl_oo。

最佳答案

您可能错过了:info object is a object 用于测试特定单词是否引用对象。

% info object isa object abcde
0
% oo::object create abcde
::abcde
% info object isa object abcde
1
% abcde destroy
% info object isa object abcde
0

这里,还有一些其他命令......

% info object isa object oo::object
1
% info object isa object while
0
% info object isa object no.such.thing.at.all.ever
0

关于tcl - 检查 TCL 中的对象是否存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38477664/

相关文章:

tcl - itcl配置方法: How to use public variables with a config script?

linux - itcl tabnotebook 在 Windows 上缺少选项卡

variables - 错误: Can't read "n" : no such variable in tcl

tcl - 如何在其他 tcl 脚本中运行 tcl 脚本?

tcl - 包需要 Tk - 在 tclsh 中不起作用

列表元素自增

oop - 如何将一个类的 itcl 对象传递给另一个类的对象并使用所传递对象的功能?

tcl - tclsh "$@" "$0" "$@"的用途和作用

tcl - 在 native OO 中是否有替代 itcl::find 的方法?