Menu

#537 [tcl] Wrong IncrTcl code generated

open
nobody
tcl (60)
5
2022-02-15
2005-02-23
Anonymous
No

When wrapping C++ class with overloaded members,
where some members has different number of arguments,
SWIG also generates IncrTcl class with multiple members
with various arguments, but IncrTcl doesn't support
overloaded members yet!

While loading wrap.itcl I get errors about "redefinition of
member XXXXX". It has to be done in another way, for
example:
use one member in IncrTcl, which has least of all arguments
and add optional (for another, overloaded versions of
members) with "default argument value", such as {varname
"value"}. Here's an example of wrong (first) ITcl class and
the second, correct:

1)
itcl::class {
#......
public method doIt {arg1 arg2 arg3} {here code}
public method doIt {arg1 arg2 arg3 arg4 arg5} {here
code}
#......
}

2)
itcl::class {
#......
public method doIt {arg1 arg2 arg3 {arg4 {}} {arg5 {}}}
{here code}
#......
}

Discussion

  • Olly Betts

    Olly Betts - 2006-09-25
    • summary: Wrong IncrTcl code generated --> [tcl] Wrong IncrTcl code generated
     
  • Olly Betts

    Olly Betts - 2022-02-15

    It doesn't look like any changes have been made to the itcl support to address this, so it's presumably still a bug.

    No idea if "IncrTcl doesn't support overloaded members yet" is still true.

    However, SWIG's ITcl support is undocumented (beyond "-itcl - Enable ITcl support" in the -tcl -help output) and has zero test coverage so I'm somewhat dubious that it works at all at this point.

     

Log in to post a comment.