Tcl Library Source Code

View Ticket
Login
2026-11-16
00:06 • Ticket [3578420fff] exists and colorful generator names status still Open with 3 other changes artifact: afa78b724d user: serhiy.storchaka
2026-11-15
23:39
Fix [3578420fff]: generator exists failed for generator names with glob or other special characters. Use namespace which -command. Add generator.test. leaf check-in: e6d2fc9a61 user: serhiy.storchaka tags: generator-exists-colorful-names
2012-10-19
18:20 • New ticket [3578420fff] exists and colorful generator names. artifact: d0a144cb95 user: pooryorick

Ticket UUID: 3578420
Title: [exists] and colorful generator names
Type: Bug Version: None
Submitter: pooryorick Created on: 2012-10-19 18:20:53
Subsystem: generator Assigned To: tallniel
Priority: 5 Medium Severity:
Status: Open Last Modified: 2026-11-16 00:06:15
Resolution: None Closed By:
    Closed on:
Description:
[exists] is currently defined like this:

proc exists generator { expr {[llength [info commands $generator]] != 0} }

this could fail if $generator contains interpreted [string match] characters.  Also, the following fix is more performant (thanks kbk):

proc exists generator { expr {[namespace which $generator] ne {}} }
User Comments: serhiy.storchaka added on 2026-11-16 00:06:15:

Proposed fix in branch generator-exists-colorful-names: exists uses namespace which -command instead of passing the name to info commands as a pattern. Adds generator.test.