[Xotcl] Send NULL arg to Class constructor

Colin Ross colross at CROSSBEAMSYS.COM
Mon Apr 27 23:44:12 CEST 2009


Hi all ­ I have ported over one of our applications from using itcl to using
xotcl. I have a lot of code that already uses the itcl stuff, so the port
must be backwards compatible. I have the following issue. Can anyone give me
an idea how I can get around it? A script that shows my issue is as follows:

#!/usr/bin/tclsh
package req XOTcl
namespace import ::xotcl::*

::xotcl::Class Connect -parameter {
    {telnet}
    {ssh}
    {ip}
}
Connect instproc init {node args} {
    [self] instvar telnet
    [self] instvar ip
}

Connect dev node -ip "127.0.0.1" -telnet

The above does not work, as it seems that the ­telnet arg must not be NULL,
however, I need this to be NULL, as it is just a flag.

If I pass in:
Connect dev node -ip "127.0.0.1" -telnet ³²

This works, however, this is not backwards compatible with how things were
with itcl, and I have too many users/scripts to change how this is done.
There are potentially 2 ways around this, however, I am unable to find
information on if either of them are possible:
1. Allow the passing in of a NULL argument
2. Prevent the constructor parsing args so that I can parse my own


I would appreciate any assistance

Cheers
Colin



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://alice.wu-wien.ac.at/pipermail/xotcl/attachments/20090427/fd0a2a4e/attachment.html 


More information about the Xotcl mailing list