From: Porter, D. <don...@ni...> - 2013-01-17 18:48:22
|
________________________________________ From: Porter, Don Sent: Thursday, January 17, 2013 1:44 PM To: Brian Griffin Subject: RE: [TCLCORE] Agressive shimmering Do you really mean to be asking about how Tcl changed between 8.4 and 8.5? Or is that a typo? If that's what you really meant to type, you might want to check whether you like Tcl 8.6 any better, because tclStringObj.c was extensively revised again in that transition. ________________________________________ From: Brian Griffin [bri...@me...] Sent: Thursday, January 17, 2013 1:22 PM To: Tcl Core List Subject: [TCLCORE] Agressive shimmering It seems that tcl 8.5 is more aggressively simmering Tcl_Obj's to a StringObj then in 8.4. This is causing problems and concerns here. The problems are ultimately self induced, but the concerns are still valid. Why is it that [string] operations blindly force conversion when there is already a string present in the obj? This seems to defeat the purpose of the Tcl_Obj! If the string representation is not going to be used, why would an alternative internal representation ever bother to produce one? (rhetorical question) Specifically, the [string length] operation is blowing away any internal representation regardless of whether a string (->bytes != NULL) is present or not. This seems unnecessary, overly aggressive, and counter intuitive given the fundamental design goal of Tcl_Obj to "behave like strings but also hold an internal representation that can be manipulated more efficiently". Blowing away the list representation just to find out the length of the string representation is darn less efficient in my book, not more. Can anyone justify this behavior? Does anyone else think that it's not right? -Brian % set x [list a b c] a b c % tcl::unsupported::DumpTclObj $x refCount = 2 bytes = 0x8ff3188 length = 5 typePtr = 0x8d21e94 (list) internal.ptr1 = 0x8ff2228 internal.ptr2 = (nil) % string length $x 5 % tcl::unsupported::DumpTclObj $x refCount = 2 bytes = 0x8ff3188 length = 5 typePtr = 0x8d221b0 (string) internal.ptr1 = 0x8ff3368 internal.ptr2 = (nil) % lindex $x 1 b % tcl::unsupported::DumpTclObj $x refCount = 2 bytes = 0x8ff3188 length = 5 typePtr = 0x8d21e94 (list) internal.ptr1 = 0x8ff2228 internal.ptr2 = (nil) |