|
2015-04-16
| ||
| 16:05 | • Closed ticket [da16fbe4a0]: Add comnand "info type" to Tcl language</... artifact: 4f94952a55 user: msofer | |
| 01:28 | • New ticket [da16fbe4a0]. artifact: 874415a7ea user: anonymous | |
Add comnand "info type" to Tcl language
Closed / Rejectedda16fbe4a036aa7dae24585478682fdc6265d68cCreated 12 years agoUpdated 12 years ago
Descriptionplain2015-04-16 01:28:44
Add a command to know the internal representation of a Tcl Object: list, dict, string, ...
It's possible to do this using: ::tcl::unsupported::representation
But it's only for debugging purposes and it's human readable.
It would be nice a command like this "info type" that returns a concise string indicating the internal representation of a Tcl Object.
One application of this new command is to transform Tcl objects to json in a robust way (without using ::tcl::unsupported::representation) as explained in this URL:
http://stackoverflow.com/questions/7428032/determine-type-of-a-variable-in-tcl
The source code of tcl2json is here:
http://rosettacode.org/wiki/JSON#Tcl
msoferplain2015-04-16 16:05:57
Please see Donald Fellows' reply on StackOverflow. The internal representation of a value has absolutely no meaning in Tcl. The command [representation] is only to be used for debugging or performance analysis purposes. This RFE is somewhat akin to someone asking to "add pointers to javascript": event though JS objects may reside at a specific address in memory, the address itself makes zero sense in JS. As the system could conceivably move the object around, a program that depends on the address is essentially buggy even if it happens to work in some circumstances.
Log in (anonymous is fine) to add a comment.