From: SourceForge.net <no...@so...> - 2008-07-11 09:00:33
|
Bugs item #2014921, was opened at 2008-07-10 11:56 Message generated for change (Comment added) made by cjmcdonald You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=2014921&group_id=10894 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 15. Dict Object Group: current: 8.5.3 >Status: Closed Resolution: Duplicate Priority: 5 Private: No Submitted By: Colin McDonald (cjmcdonald) Assigned to: Don Porter (dgp) Summary: list from dict or "array get" loses internal representations Initial Comment: Accessing a dict Tcl_Obj as a list loses the internal representations of all of the element Tcl_Objs. This is because the list object is rebuilt in SetListFromAny from the dict string representation. In Tcl 8.5 "array get" has been modified to return a dict object. A consequence of this is that the following code now loses all of the internal representations of the aname and avalue elements. # Process all array elements. foreach {aname avalue} [array get arrayVariable] { # Do something with $aname & $avalue. } This is a very common idiom (at least in my code!), and corresponds to examples on the array man page and in various Tcl books. So we have something of a performance regression from Tcl 8.4. The problem can be avoided by modifying all such usage to "dict for". However, that is rather obscure, particularly as the array man page only talks about lists and not dicts. I think that it would be good if SetListFromAny could recognise and process a dict object in such a way as to preserve the element Tcl_Objs. ---------------------------------------------------------------------- >Comment By: Colin McDonald (cjmcdonald) Date: 2008-07-11 10:00 Message: Logged In: YES user_id=883691 Originator: YES Yes, it is a duplicate of 2008248. For some reason the sourceforge search won't work on my corporate pc/browser at work, which may be why I missed that one. ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2008-07-10 18:01 Message: Logged In: YES user_id=80530 Originator: NO Looks like a duplicate of 2008248 ? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=2014921&group_id=10894 |