Overview
| Artifact ID: | 8ad84f8c6bba9f5557e2b1da69392173ec6b5a97 |
|---|---|
| Ticket: | 1917650fffffffffffffffffffffffffffffffff
Tcl_ConvertToType(, , doubleType) incompatibility |
| User & Date: | dgp on 2008-06-17 11:43:15 |
Changes
- icomment:
Logged In: YES user_id=80530 Originator: NO This bug report is correct. The docs are out of date. We'll get it fixed. The old rule was the SetFooFromAny() routine would set the Tcl_ObjType to "foo". In this case, SetDoubleFromAny() would shimmer to the "double" Tcl_ObjType or fail. This routine forms the guts of a Tcl_ConvertToType() call, so that call would also produce a "double" Tcl_ObjType or fail. The new rule is that SetFooFromAny() sets the internal rep to whatever Tcl_ObjType it wants, so that future GetFooFromObj() calls are fast compared with conversion from string. Tcl_ConvertToType() no longer guarantees to convert to the Tcl_ObjType you pass in, and the new advice is that you shouldn't be calling Tcl_ConvertToType in the first place. Let the owner of the Tcl_ObjType use it (and have the freedom to change it). For the particular example SetDoubleFromAny(), it can shimmer to any numeric Tcl_ObjType. That is, it does exactly what TclParseNumber() does, take a string and produce the Tcl_Obj with the most appropriate internal numeric rep to hold the numeric value. That's why SetDoubleFromAny() is implemented as a simple call to TclParseNumber(). There is no TCL_PARSE_DOUBLE flag, so I don't understand your particular question. And I don't grok dkf's comments either. I wonder if we're looking at the same HEAD. You went on to write a novel, but I'm getting off now.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"