Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 8b5636d366391bfece66cb04f41f329b1d3942566ce59ee77a7444bf7232994b
Ticket: 6ee2f5d5d6bc7d697b735f5389d833ff9e61e217
Tcl 9.0 "invalid character in array index" error for $a("b")
User & Date: jdelsign on 2026-07-29 20:20:21
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-plain"
  4. comment changed to:
    I am in the process of upgrading from Tcl 8.6.14 to Tcl 9.0.4. The following commands produce an error in Tcl 9.0.4, but it was OK in Tcl 8.6.14.
    
    $ tclsh
    % set tcl_patchLevel
    9.0.4
    % set a("b") x
    x
    % array names a
    {"b"}
    % set a(b) y
    y
    % array names a
    b {"b"}
    % puts $a(b)
    y
    % puts $a("b")
    invalid character in array index
    % 
    
    Why is that an error in Tcl 9.0.4?
    
    The workaround I have been using is to access the value using set:
    
    % set a("b")  
    x
    %
    
  5. foundin changed to: "9.0.4"
  6. is_private changed to: "0"
  7. login: "jdelsign"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "cda79e7c26c7aaa8a79a31b5a67382ef3b84d2c9"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "jdelsign"
  14. subsystem changed to: "07. Variables"
  15. title changed to:
    Tcl 9.0 "invalid character in array index" error for $a("b")
    
  16. type changed to: "Bug"