Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 9d5fe46d3db7b28b4db38a24d9771a87a3c10802
Ticket: 449893ffffffffffffffffffffffffffffffffff
traces on array misbehaving
User & Date: msofer on 2001-12-02 07:39:39
Changes

  1. icomment:
    
    
    File Added - 14049: arrayGet.patch
    
    Logged In: YES 
    user_id=148712
    
    It is difficult to define what the correct behaviour of
    [array get]
    should be when there are read traces that modify the array 
    structure. 
    
    In discussions on the Tcl'ers Chat with Kevin Kenny and 
    Don Porter we agreed that a (the only ?) reasonable
    behaviour 
    is given by
    
     proc array-get { aName } {
         set result [list]
         upvar 1 $aName array
         foreach s [array names array] {
             if { [info exists array($s)] } { 
         # because a trace could have deleted it 
                 lappend result $s $array($s)
             }
         }
         return $result
     }
    
    The enclosed patch implements this behaviour and adds three
    tests 
    for it. These tests cause illegal memory behaviour without
    the patch 
    to tclVar.c - an access to a previously disposed Tcl_Obj is
    detected 
    by TCL_MEM_DEBUG. 
    
    
    
  2. login: "msofer"
  3. mimetype: "text/plain"
  4. username: "msofer"