Tk Library Source Code

View Ticket
Login
Ticket UUID: 1471885
Title: snit2.tcl - faulty "in" keyword
Type: Bug Version: None
Submitter: nobody Created on: 2006-04-17 18:32:34
Subsystem: snit Assigned To: dgp
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2006-04-18 23:18:27
Resolution: Invalid Closed By: dgp
    Closed on: 2006-04-18 04:16:32
Description:
Don't know what the deal is..


-@- -) tclsh
% info tclversion
8.5
% info patchlevel
8.5a2
% package require snit
2.0
% snit::type dog { }
syntax error in expression "$name in $arglist": extra 
tokens at end of expression


So I look in the source and find
    if {$name in $arglist} {
replace it with
    if {[lsearch $arglist $name] != 1} {
and recompile which fixes that 'bug'.


-@- -) tclsh
...
% snit::type dog { }
::dog
% snit::type dog {option -color brown}
syntax error in expression "$option in $compile
(delegatedoptions)": extra tokens at end of expression


So I find all instances of:
    if {X in Y} {
replace them with
    if {[lsearch Y X] != 1} {
and recompile to fix.


But what gives? I can't find "X in Y" used anywhere 
else in tcllib, and the only clue I have is the "in" 
procedure for xifo objects.

Dylan.
User Comments: nobody added on 2006-04-18 23:18:27:
Logged In: NO 

Ok, thanks. Did not even know there's a new "in" keyword.
I guess I was using the latest ActiveState Mac release.

Dylan.

dgp added on 2006-04-18 11:16:32:
Logged In: YES 
user_id=80530


If you're going to rely
on alpha releases, you'll
have to pay some attention
to ongoing development.

Are you confident that you're
working with the actual 8.5a2
release?  Or could this be
a snapshot of the development
sources taken before release?
The 'changes' file reports:

...
2004-10-08 (new feature)[TIP 201] "in" and "ni" expr
operators (fellows)
...
--- Released 8.5a2, December 7, 2004 --- See ChangeLog for
details ---
...

so any install of the actual 8.5a2
release (or better yet, 8.5a3, or
an 8.5a4 release candidate, or the
latest development snapshot you can
stand), ought to resolve the issue.

If there's a bug here, it might be
that things would be a bit better
if snit could indicate its need
for 8.5a2 or better, so that a
[package require] might fail instead
of a random command.  There are
two obstacles to that.

First, the [package] command fails
to support version numbers with
alpha or beta designations.  This
is Tcl Feature Request 219296.

Second, during alpha development,
it's fairly common to run into
an interpreter that isn't based
on any official release, but is some 
development snapshot that may or
may not have the same features as
its [info patchlevel] would indicate.
So even a working
[package require Tcl 8.5a2] would
not help since your interp claims
to be 8.5a2 but lacks the features
of the real 8.5a2 release.  One can
imagine version number bumping
schemes that could deal with that, but
getting them followed reliably seems
unlikely.

Update your Tcl to one that supports
the "in" operator.