Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 221d2d9c49650be6d6ab4e72bd6add0c8289e25d
Ticket: 1022151fffffffffffffffffffffffffffffffff
'array unset' inconsistency ?
User & Date: andreas_kupries on 2004-09-03 23:20:22
Changes

  1. assignee changed to: "msofer"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    IMHO the behaviour of the command
        'array unset ?pattern?'
    is inconsistent, and the problem is exacerbated by an
    ambiguous description in its manpage.
    
    Take an array variable, add some elements, then execute
    
    (1)     unset a
    (2)     array unset a
    (3)array unset a *
    
    [This has to be done independently, not one after the
    other]
    
    Tracing and checking the results of the commands shows
    that the scenarios (1) and (2) are equivalent. Whereas
    the regular pattern for this type of command is to make
    (2) and (3) equivalent.
    
    However when reading the documentation for 'array unset'
    it seems to imply the (2)/(3) equivalence:
    
            Unsets all of the elements in the array that match
            pattern(using the matching rules of string match).
            [...] If pattern is omitted and arrayName is an
    array
            variable, then the command unsets the entire array.
    
    Because of the first sentence it can be assumed while
    reading the last sentence that 'unsetting the entire array'
    means the removal of all elements in the array, and not
    the removal of the variable.
    
    Only then reading them disconnected it becomes clear
    that the last sentence means that the variable is unset,
    not its elements.
    
    Either documentation or behaviour should be fixed.
    Preferably both.
    
    
  4. foundin changed to: "obsolete: 8.4.7"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "andreas_kupries"
  9. subsystem changed to: "07. Variables"
  10. title changed to: "'array unset' inconsistency ?"
  11. type changed to: "Bug"