<i>list from dict or "array get" loses internal representations</i>.
by
.
D 2008-07-10T10:56:37
J assignee dkf
J cmimetype text/plain
J comment Accessing\sa\sdict\sTcl_Obj\sas\sa\slist\sloses\sthe\sinternal\srepresentations\sof\sall\sof\sthe\selement\sTcl_Objs.\s\sThis\sis\sbecause\sthe\slist\sobject\sis\srebuilt\sin\sSetListFromAny\sfrom\sthe\sdict\sstring\srepresentation.\n\nIn\sTcl\s8.5\s"array\sget"\shas\sbeen\smodified\sto\sreturn\sa\sdict\sobject.\s\sA\sconsequence\sof\sthis\sis\sthat\sthe\sfollowing\scode\snow\sloses\sall\sof\sthe\sinternal\srepresentations\sof\sthe\saname\sand\savalue\selements.\n\n\s\s\s\s#\sProcess\sall\sarray\selements.\n\s\s\s\s\n\s\s\s\sforeach\s{aname\savalue}\s[array\sget\sarrayVariable]\s{\n\s\s\s\s#\sDo\ssomething\swith\s$aname\s&\s$avalue.\s\s\s\s\n\s\s\s\s}\n\s\s\s\s\nThis\sis\sa\svery\scommon\sidiom\s(at\sleast\sin\smy\scode!),\sand\scorresponds\sto\sexamples\son\sthe\sarray\sman\spage\sand\sin\svarious\sTcl\sbooks.\s\sSo\swe\shave\ssomething\sof\sa\sperformance\sregression\sfrom\sTcl\s8.4.\n\nThe\sproblem\scan\sbe\savoided\sby\smodifying\sall\ssuch\susage\sto\s"dict\sfor".\s\sHowever,\sthat\sis\srather\sobscure,\sparticularly\sas\sthe\sarray\sman\spage\sonly\stalks\sabout\slists\sand\snot\sdicts.\s\sI\sthink\sthat\sit\swould\sbe\sgood\sif\sSetListFromAny\scould\srecognise\sand\sprocess\sa\sdict\sobject\sin\ssuch\sa\sway\sas\sto\spreserve\sthe\selement\sTcl_Objs.
J foundin obsolete:\s8.5.3
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter cjmcdonald
J subsystem 15.\sDict\sObject
J title list\sfrom\sdict\sor\s"array\sget"\sloses\sinternal\srepresentations
J type Bug
K 2014921fffffffffffffffffffffffffffffffff
U cjmcdonald
Z 5ddc6fdd60dd99ea7133fb539ef2e9ab