Re: a typeof command for debugging?

Liste des GroupesRevenir à cl tcl 
Sujet : Re: a typeof command for debugging?
De : auriocus (at) *nospam* gmx.de (Christian Gollwitzer)
Groupes : comp.lang.tcl
Date : 21. Jun 2025, 14:58:50
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <1036dqq$13c9j$2@dont-email.me>
References : 1 2
User-Agent : Mozilla Thunderbird
shows you the last type that was used on that object (besides string):
 (chris) 50 % set a [expr {23*5}]
115
(chris) 51 % tcl::unsupported::representation $a
value is a int with a refcount of 4, object pointer at 0x55d6b8f8b320, internal representation 0x73:(nil), string representation "115"
            Christian
PS: Since you are new to Tcl, please have a look at the following:
(chris) 52 % set a {1 2 3 4}
1 2 3 4
(chris) 53 % tcl::unsupported::representation $a
value is a pure string with a refcount of 5, object pointer at 0x55d6b8f8ac90, string representation "1 2 3 4"
(chris) 54 % lindex $a 2
3
(chris) 55 % tcl::unsupported::representation $a
value is a list with a refcount of 4, object pointer at 0x55d6b8f8ac90, internal representation 0x55d6b8c06cf0:(nil), string representation "1 2 3 4"
(chris) 56 %
Also, the {} do not make the list, they are a quoting mechanism. You will get an identical result if you use "":
(chris) 61 % tcl::unsupported::representation $b
value is a pure string with a refcount of 5, object pointer at 0x55d6b8f85860, string representation "1 2 3 4 5 6"
(chris) 62 % lindex $b 2
3
(chris) 63 % tcl::unsupported::representation $b
value is a list with a refcount of 4, object pointer at 0x55d6b8f85860, internal representation 0x55d6b8f14b40:(nil), string representation "1 2 3 4 5 6"
(chris) 64 %
And, there is "constant sharing". After you ran the previous examples, try with another surprise:
(chris) 64 % set c "1 2 3 4"
1 2 3 4
(chris) 65 % tcl::unsupported::representation $c
value is a list with a refcount of 9, object pointer at 0x55d6b8f8ac90, internal representation 0x55d6b8c06cf0:(nil), string representation "1 2 3 4"
(chris) 66 %
Christian

Date Sujet#  Auteur
21 Jun 25 * a typeof command for debugging?8Mark Summerfield
21 Jun 25 `* Re: a typeof command for debugging?7Christian Gollwitzer
21 Jun 25  +- Re: a typeof command for debugging?1Christian Gollwitzer
22 Jun 25  `* Re: a typeof command for debugging?5Mark Summerfield
22 Jun 25   +* Re: a typeof command for debugging?2Ralf Fassel
22 Jun 25   i`- Re: a typeof command for debugging?1Mark Summerfield
22 Jun 25   `* Re: a typeof command for debugging?2Christian Gollwitzer
23 Jun 25    `- Re: a typeof command for debugging?1Christian Gollwitzer

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal