Overview
| Artifact ID: | 5ba44d1c5be84f7d639af1f5f7b0341ebfeb344a |
|---|---|
| Ticket: | 9ec7bd5f329df1ff790266b3c318a837ac32895e
Some way to modify complex data structures efficiently |
| User & Date: | anonymous on 2015-05-09 04:40:48 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
It seems that TCL can only tackle efficiently complex data structure that are only composed of lists or only composed of dicts. But when there is a mix of data structures (lists and dicts) and it's necessary to modify an internal node, TCL makes a copy and modifies that copy, instead of modify directly the internal node. Here there is an example: set complex_datastructure [dict create a b c [list 1 2 3]] # We get the list inside the dict set subnode [dict get $complex_datastructure c] # We retrieve the internal representation and we observe that subnode is a list. The pointer reference is 0x98c1270. puts [tcl::unsupported::representation $subnode] # Return value: value is a list with a refcount of 3, object pointer at 0x98b6f08, internal representation 0x98c1270:(nil), no string representation # We change the subnode lset subnode 0 10 # We get the internal representation again but the pointer reference is different: 0x98b7838! puts [tcl::unsupported::representation $subnode] # Return value: value is a list with a refcount of 2, object pointer at 0x98b7838, internal representation 0x98caa40:(nil), no string representation # The pointer of the original data structure subnode is the same as the begining. It didn't change: 0x98c1270 puts [tcl::unsupported::representation [dict get $complex_datastructure c]] # Return: value is a list with a refcount of 2, object pointer at 0x98b6f08, internal representation 0x98c1270:(nil), no string representation
- foundin changed to: "8.6"
- is_private changed to: "0"
- login: "anonymous"
- priority changed to: "5 Medium"
- private_contact changed to: "1c4b6cdb98c9dfc4d1e74018f3f4efa00ad217e2"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "anonymous"
- subsystem changed to: "- New Builtin Commands"
- title changed to:
Some way to modify complex data structures efficiently
- type changed to: "Bug"