if_tcl.c redefinition of Tcl catch command breaks Tcl 8.5 modules

60 views
Skip to first unread message

Po Shan Cheah

unread,
Aug 11, 2010, 2:34:01 AM8/11/10
to vim_dev
I've been trying to figure out a problem in Vim 7.3f Beta compiled
with tcl/dyn and Tcl version 8.5 on the Windows platform. The symptom
is the first time I run the following command:

:tcl package require tls

It produces this error message:

wrong # args: should be "catch command ?varName?"

After searching the web for solutions, I found this discussion thread,
which explains the problem: http://objectmix.com/tcl/15892-tcl-interp-inside-vim-throws-error-w-clock-format.html

It appears that Vim's if_tcl.c redefines the catch command.

In Tcl 8.4, the syntax of the catch command is:

catch script ?varName?

However, in Tcl 8.5, catch can take an optional third argument:

catch script ?resultVarName? ?optionVarName?

Vim's redefinition of the catch command supports only the Tcl 8.4
catch syntax, so in Tcl 8.5, any catch command with 3 arguments will
trigger the above error message.

Following the suggestion given at the end of the discussion thread, I
removed the code in if_tcl.c that redefines catch and recompiled Vim.
"tcl package require tls" does work in this build, although I'm not
sure if this change will break something else. Before Vim 7.3 is
finalized, could I have a fix in if_tcl.c to correct this
compatibility problem with Tcl 8.5?
Reply all
Reply to author
Forward
0 new messages