Tcl Syntax Check on Close Command

I use this command “close -i $localID” in much of my code. It does function. It does not create any errors when executed. If I remove it I get left over session IDs which eventually depletes available resources and scripts eventually fail due to the lack of resources. Based on code behavior and a fair amount of testing I do believe this is a valid syntax. I have even found references that indicate it is or at least was supported in Tcl.
My issue is with Komodo syntax checking. Komodo reports every instance of this command as an error.
The exact message is “Error: wrong # args”.
Is this, or was this ever, valid in Tcl?
Is it possible to exclude or include specific syntax checks within Komodo?

Could you share a complete code snippet that reproduces what you believe to be an invalid linter error?

Any line that includes that exact text “close -i $localID”. The $localID is created with any number of spawned sessions, typically with SSH. Here is one example of the spawned session command.
spawn ssh -o StrictHostKeyChecking=no -l $userName $userIpa
set localID $spawn_id

close -i $localID

If I remove the “-i” the error is not reported but the session does not always get closed as expected.

I’m not able to reproduce this. What Tcl version are you using? Have you customized anything under Preferences > Tcl > Syntax Checking ?

No customization. If this is a possibility then this is part of my question. How would something like this be accomplished?

TCL Version 8.5

This sample produces the error:

#!/usr/bin/tclsh

package require Tcl
package require tdom
package require Expect
set spawn_id ""
set userName "me"
set userIpa "192.168.0.14"
spawn ssh -o StrictHostKeyChecking=no ${userName}@${userIpa}
set localID $spawn_id

catch { close -i $localID }
catch { wait -i $localID }
exit

Still cannot repro. @careyh @mitchell can you try?

I am sending a screenshot. I am not imagining this. It happened in the previous version. It is still happening in 10.2 and I would like to have a solution.

I’m not questioning whether you are seeing the issue, but we have to reproduce it in order to figure out what is happening.

I’m seeing the syntax error. It does look like close is supposed to take 2 args, one of which is optional:
http://www.tcl.tk/man/tcl/TclCmd/close.htm

  • Carey

@nathanr I am not able to reproduce this on Linux.

I use Cygwin on Windows 7. This should not matter if the only action is to check syntax of TCL Code. Neither should it matter within Komodo unless there are different syntax checkers depending on platform. Where does the Komodo syntax checker come from?

I agree it should not matter, but we need to dig down on the details in order to identify the bug.

The syntax checker is a proprietary component developed by ActiveState.

I’ve opened a bug for this issue here:

@tom.everett I just had Graham, our QA expert, poke me about this issue. He says this is by design. I quote:

Two argument half close isn’t supported until 8.6, so Komodo would be correct in the context of Tcl 8.5 or Tcl 8.4
A lot of components in the TDK assume a default version of 8.5. I haven’t heard of the linter having any default version before, but there is a bias toward older versions across the board.

Given this new information, I think you have 3 options:

  • Update Tcl to 8.6
  • Force Komodo to do syntax checking for version 8.6
  • Disable error reporting for this type of error in Komodo

I have no idea what this means “Two argument half close”. Where is the specific documentation for TCL that defines this and any other version specific syntax of “close”?
I will consider upgrading to TCL 8.6 but how would this change syntax checking in Komodo if the file I present to Komodo is exactly the same? It seems like option 1 is not effective without the simultaneous use of option 2 or 3.
I would like more information on the other two options you suggest.
Where are these suggestions explained and/or defined?
“• Force Komodo to do syntax checking for version 8.6”
“• Disable error reporting for this type of error in Komodo”

Both of these settings can be changed from Preferences > Languages > Tcl > Syntax Checking.

Note that for the warning/error messages to suppress lists you can double click an entry to “toggle” it, however the UI here is currently bugged and it will not indicate whether an item is checked or not. I’ve opened a priority bug for this here:

You can still toggle items, it just doesnt indicate whether something is toggled.

I’m not a Tcl developer, but it sounds to me that there is a slight syntactical difference between versions 8.5 and 8.6. So upgrading to 8.6 would make Komodo apply the 8.6 ruleset to your syntax. Therefore options 1 should not be tied to options 2 and 3.

“Prefs > Languages > Tcl > Syntax Checking”
I see no such path.
I see “Preferences -> Language Help” or “Preferences -> Syntax and Spell Checking”.
When I follow some similar path I see no option to change any individual syntax check option.
“Preferences -> Syntax and Spell Checking -> Language-specific syntax checking properties” only has a check box to turn syntax checking on or off.
I am using Komodo version 10.2.0, Build 89833, platform win32-X86

“I’m not a Tcl developer, but it sounds to me that there is a slight syntactical difference between versions 8.5 and 8.6.”
I am not a TCL developer either but I am smart enough to know that Komodo should not be looking for installed TCL in order to determine how to check version specific syntax.
What if TCL is not installed on the system used for Komodo?
You specifically stated there was a difference so I am asking for a pointer to some documentation or some specification that supports your conclusion.

“So upgrading to 8.6 would make Komodo apply the 8.6 ruleset to your syntax.”
Upgrading TCL to any version does not have anything to do with Komodo as far as I can see. You yourself indicated that for Komodo “The syntax checker is a proprietary component” so I fail to see the connection to “installed TCL” if I am just opening a TCL file to perform some basic edits or syntax checking.

You are not helping, but rather just raising more questions.

The path is collapsed, you have to double click an item to expand it, or press the “twisty” icon.

Komodo is “smart enough” to see what version of Tcl you have installed in order to then perform the right type of syntax checking.

Then you can force your own Tcl version as per the prefs.

I’m just the messenger in this regard, I am not a Tcl developer nor a language maintainer. I would recommend refererencing the official docs or posting on a Tcl forum.

You are not getting it.
I do not see this path ANYWHERE so you are going to have to be very specific.
The same applies to all your suggestions related to changing items in komodo.
Maybe you have a different version, I have no idea. all I know is that I can’t find the options/preferences you are referring to.
Is there a preferences files I can open and edit? Maybe this would be easier.

“press the “twisty” icon”
What is this?

I do not have TCL installed on my laptop so Komodo does not have any idea what version of TCL to assume.
I have looked extensively for documentation that specifically describes the “close” syntax and have found nothing that refers to using the “-i”. The only thing that refers to this is “Expect” documentation but I can only assume “Expect” is equal to TCL without specific documentation. I came to this forum because you are the Komodo experts and I thought you could help. Maybe this is a mistake.

Sorry, I assumed “Preferences” would be a starting point you’d be familiar with. You’re going to want to bring up the Preferences window by pressing the burger menu at the top right of Komodo, then navigating to Edit > Preferences. Alternatively you can press the ALT key to bring up the menubar and then navigate to Edit > Preferences. From there you should be able to follow my original instructions.

I’ve asked Graham for a source on the close syntax, this is what he gave me:

http://docs.activestate.com/activetcl/8.5/tcl/TclCmd/close.htm
Only one argument is listed. “close channelId”
http://docs.activestate.com/activetcl/8.6/tcl/TclCmd/close.htm
Now supports "close channelId ?read/write?
Also here, in New in Tcl 8.6, under Expanded Syntax/New Options
http://wiki.tcl.tk/21276

I believe that should answer your question in regards to syntax.