Deutsch English Français Italiano |
<1036dqq$13c9j$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Christian Gollwitzer <auriocus@gmx.de> Newsgroups: comp.lang.tcl Subject: Re: a typeof command for debugging? Date: Sat, 21 Jun 2025 15:58:50 +0200 Organization: A noiseless patient Spider Lines: 53 Message-ID: <1036dqq$13c9j$2@dont-email.me> References: <10364a2$11i1c$1@dont-email.me> <1036dd3$13c9j$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sat, 21 Jun 2025 15:58:51 +0200 (CEST) Injection-Info: dont-email.me; posting-host="c43880425a29be66687deed006bc9c56"; logging-data="1159475"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/89rKtJLaJv6HD5cAP65saB7z4fluzMJw=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:LiMrgSKk+M0k/1jpFohvzOL9a90= In-Reply-To: <1036dd3$13c9j$1@dont-email.me> > 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