Skip to content
Tcl Source Code Artifact [5ba44d1c5b]
Login

Artifact [5ba44d1c5b]

Artifact 5ba44d1c5be84f7d639af1f5f7b0341ebfeb344a:

Ticket change [5ba44d1c5b] - New ticket [9ec7bd5f329df1ff|9ec7bd5f32] <i>Some way to modify complex data structures efficiently</i>. by anonymous on 2015-05-09 04:40:48.
D 2015-05-09T04:40:48.357
J assignee nobody
J closer nobody
J cmimetype text/plain
J comment It\sseems\sthat\sTCL\scan\sonly\stackle\sefficiently\scomplex\sdata\sstructure\sthat\sare\sonly\scomposed\sof\slists\sor\sonly\scomposed\sof\sdicts.\sBut\swhen\sthere\sis\sa\smix\sof\sdata\sstructures\s(lists\sand\sdicts)\sand\sit's\snecessary\sto\smodify\san\sinternal\snode,\sTCL\smakes\sa\scopy\sand\smodifies\sthat\scopy,\sinstead\sof\smodify\sdirectly\sthe\sinternal\snode.\r\n\r\nHere\sthere\sis\san\sexample:\r\n\r\n\r\nset\scomplex_datastructure\s[dict\screate\sa\sb\sc\s[list\s1\s2\s3]]\r\n\r\n#\sWe\sget\sthe\slist\sinside\sthe\sdict\r\nset\ssubnode\s[dict\sget\s$complex_datastructure\sc]\r\n\r\n#\sWe\sretrieve\sthe\sinternal\srepresentation\sand\swe\sobserve\sthat\ssubnode\sis\sa\slist.\sThe\spointer\sreference\sis\s0x98c1270.\r\nputs\s[tcl::unsupported::representation\s$subnode]\r\n\r\n#\sReturn\svalue:\svalue\sis\sa\slist\swith\sa\srefcount\sof\s3,\sobject\spointer\sat\s0x98b6f08,\sinternal\srepresentation\s0x98c1270:(nil),\sno\sstring\srepresentation\r\n\r\n#\sWe\schange\sthe\ssubnode\r\nlset\ssubnode\s0\s10\r\n\r\n#\sWe\sget\sthe\sinternal\srepresentation\sagain\sbut\sthe\spointer\sreference\sis\sdifferent:\s0x98b7838!\r\nputs\s[tcl::unsupported::representation\s$subnode]\r\n\r\n#\sReturn\svalue:\svalue\sis\sa\slist\swith\sa\srefcount\sof\s2,\sobject\spointer\sat\s0x98b7838,\sinternal\srepresentation\s0x98caa40:(nil),\sno\sstring\srepresentation\r\n\r\n\r\n#\sThe\spointer\sof\sthe\soriginal\sdata\sstructure\ssubnode\sis\sthe\ssame\sas\sthe\sbegining.\sIt\sdidn't\schange:\s0x98c1270\r\nputs\s[tcl::unsupported::representation\s[dict\sget\s$complex_datastructure\sc]]\r\n\r\n#\sReturn:\svalue\sis\sa\slist\swith\sa\srefcount\sof\s2,\sobject\spointer\sat\s0x98b6f08,\sinternal\srepresentation\s0x98c1270:(nil),\sno\sstring\srepresentation
J foundin 8.6
J is_private 0
J login anonymous
J priority 5\sMedium
J private_contact 1c4b6cdb98c9dfc4d1e74018f3f4efa00ad217e2
J resolution None
J severity Minor
J status Open
J submitter anonymous
J subsystem -\sNew\sBuiltin\sCommands
J title Some\sway\sto\smodify\scomplex\sdata\sstructures\sefficiently
J type Bug
K 9ec7bd5f329df1ff790266b3c318a837ac32895e
U anonymous
Z 00182579691d1fa4a7354684510d1e84