Tk Library Source Code

View Ticket
Login
Ticket UUID: 1034924
Title: children with filter requires struct::list
Type: Bug Version: None
Submitter: coldstore Created on: 2004-09-26 09:21:57
Subsystem: struct :: tree Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2004-09-30 00:34:25
Resolution: Fixed Closed By: andreas_kupries
    Closed on: 2004-09-29 17:34:25
Description:
It is necessary for a user of [tree children] with
filter to have [package require]d struct::list, or
it'll crash.

Solution is either to put a package require into the
children source, or to document the dependency.
User Comments: andreas_kupries added on 2004-09-30 00:34:25:
Logged In: YES 
user_id=75003

Fixes committed to head.

coldstore added on 2004-09-30 00:08:14:
Logged In: YES 
user_id=19214

Yes, sure, package require in global scope would work.

It'd make the dependency clear at the top, too, which is good.

Putting it close to the use point is probably an unwarranted
micro-optimisation, wouldn't save much, and isn't very
idiomatic from what I've seen of tcl common usage.

So by all means, package require struct::list at the top.

andreas_kupries added on 2004-09-30 00:08:01:
Logged In: YES 
user_id=75003

More: Graph has the same problem, for the methods "arcs",
and "nodes".

andreas_kupries added on 2004-09-30 00:03:25:
Logged In: YES 
user_id=75003

Note: If you use the option to get _all_ children, i.e.
-all, you will also need struct::list.

Ditto for method "descendants".

Another alternative is to simply make all of struct::tree
dependent on struct::list ?

coldstore added on 2004-09-26 16:27:02:
Logged In: YES 
user_id=19214

This demonstrates the problem:

% package require struct::tree
2.0

% struct::tree
::tree1

% tree1 children root filter puts
invalid command name "::struct::list"


Whereas this works:

% package require struct::tree
2.0

% package require struct::list
1.4

% struct::tree
::tree1

% tree1 children root filter puts
%