Tcl:命令名创建 [英] Tcl: command name creation

查看:40
本文介绍了Tcl:命令名创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 tcl 代码中有这样一行:

I have a line in my tcl code like this:

应用程序/BitTorrent 设置 seqNo_ $opt(seqNo)

Application/BitTorrent set seqNo_ $opt(seqNo)

..我有一个 OTcl 类名Application/BitTorrent",我收到这个错误...

..I have an OTcl class name "Application/BitTorrent", I get this ERROR...

无效的命令名称Application/BitTorrent"执行时应用程序/BitTorrent 设置 seqNo_ $opt(seqNo)"谁能告诉我在 tcl 中创建命令的语法或方式?

invalid command name "Application/BitTorrent" while executing "Application/BitTorrent set seqNo_ $opt(seqNo)" can anybody tell me the syntax or the way to create a command in tcl?

谢谢!

推荐答案

不确定 OTcl 语法,但通常对于 OO 风格的 Tcl 扩展,它会是这样的:

No sure about OTcl Syntax, but usually for the OO style Tcl extensions it would be like:

Application/BitTorrent myapp
myapp set seqNo_ $opt(seqNo)

首先创建一个 Application/BitTorrent 类的实例,然后对其使用 set 方法.但是您的错误表明您的课程可能存在一些问题,例如它不可见或类似的东西.如果该类确实存在并且按照您期望的方式命名,您应该使用内省命令(如 [info commands] 或相应的 OTcl 版本)进行检查.

first creating an instance of class Application/BitTorrent and than using the set method on it. But your error indicates there might be some problem with your class, e.g. its not visible or something like that. You should check with introspection commands like [info commands] or the appropriate OTcl versions if the class really exists and is named like you expect it.

这篇关于Tcl:命令名创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆