Created
November 13, 2022 13:24
-
-
Save cben/a8aa98cd796148d630c9b3c7277ac6fa to your computer and use it in GitHub Desktop.
Session dump from https://www.youtube.com/watch?v=M59FJbNFbUY&t=1335
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
beni@beni580 ~> tclsh | |
% set n 42 | |
42 | |
% tcl::unsupported::representation $n | |
value is a pure string with a refcount of 4, object pointer at 0x5604d811de00, string representation "42" | |
% expr {$n + 1} | |
43 | |
% tcl::unsupported::representation $n | |
value is a int with a refcount of 4, object pointer at 0x5604d811de00, internal representation 0x2a:(nil), string representation "42" | |
% | |
% | |
% | |
% | |
% set a {foo 12 bar {puts hello}} | |
foo 12 bar {puts hello} | |
% tcl::unsupported::representation $n | |
value is a int with a refcount of 4, object pointer at 0x5604d811de00, internal representation 0x2a:(nil), string representation "42" | |
% tcl::unsupported::representation $a | |
value is a pure string with a refcount of 4, object pointer at 0x5604d811e880, string representation "foo 12 bar {p..." | |
% list index $a 3 | |
index {foo 12 bar {puts hello}} 3 | |
% lindex $a 3 | |
puts hello | |
% tcl::unsupported::representation $a | |
value is a list with a refcount of 4, object pointer at 0x5604d811e880, internal representation 0x5604d816ace0:(nil), string representation "foo 12 bar {p..." | |
% set inner [lindex $a 3] | |
puts hello | |
% puts inner | |
inner | |
% puts $inner | |
puts hello | |
% tcl::unsupported::representation $a | |
value is a list with a refcount of 4, object pointer at 0x5604d811e880, internal representation 0x5604d816ace0:(nil), string representation "foo 12 bar {p..." | |
% value is a list with a refcount of 4, object pointer at 0x5604d811e880, internal representation 0x5604d816ace0:(nil), string representation "foo 12 bar {p..." | |
invalid command name "value" | |
% tcl::unsupported::representation $inner | |
value is a pure string with a refcount of 3, object pointer at 0x5604d81b3d00, string representation "puts hello" | |
% lindex $inner 0 | |
puts | |
% lindex $inner 1 | |
hello | |
% tcl::unsupported::representation $inner | |
value is a list with a refcount of 3, object pointer at 0x5604d81b3d00, internal representation 0x5604d8137ba0:(nil), string representation "puts hello" | |
% eval [linder $a 3] | |
invalid command name "linder" | |
% eval [lindex $a 3] | |
hello | |
% tcl::unsupported::representation $inner | |
value is a bytecode with a refcount of 3, object pointer at 0x5604d81b3d00, internal representation 0x5604d816b4e0:(nil), string representation "puts hello" | |
% dict get $a bar | |
puts hello | |
% tcl::unsupported::representation $a | |
value is a dict with a refcount of 5, object pointer at 0x5604d811e880, internal representation 0x5604d816b5e0:(nil), string representation "foo 12 bar {p..." | |
% dict keys $a | |
foo bar | |
% lindex [lindex $a 3] 0 | |
puts | |
% tcl::unsupported::representation $a | |
value is a list with a refcount of 3, object pointer at 0x5604d811e880, internal representation 0x5604d816a9e0:(nil), string representation "foo 12 bar {p..." | |
% tcl::unsupported::representation $inner | |
value is a bytecode with a refcount of 2, object pointer at 0x5604d81b3d00, internal representation 0x5604d816b4e0:(nil), string representation "puts hello" | |
% tcl::unsupported::representation [lindex $a 3] | |
value is a list with a refcount of 2, object pointer at 0x5604d811d530, internal representation 0x5604d8175780:(nil), string representation "puts hello" | |
% set d [dict create key value] | |
key value | |
% dict keys $d | |
key | |
% tcl::unsupported::representation $d | |
value is a dict with a refcount of 4, object pointer at 0x5604d8120d10, internal representation 0x5604d816b5e0:(nil), string representation "key value" | |
% set d [dict create key value] | |
key value | |
% dict keys [set d2 [dict create key value]] | |
key | |
% tcl::unsupported::representation $d2 | |
value is a dict with a refcount of 7, object pointer at 0x5604d8120d10, internal representation 0x5604d816b5e0:(nil), string representation "key value" | |
% tcl::unsupported::representation [dict create key value] | |
value is a dict with a refcount of 8, object pointer at 0x5604d8120d10, internal representation 0x5604d816b5e0:(nil), string representation "key value" | |
% tcl::unsupported::representation [list foo bar] | |
value is a list with a refcount of 2, object pointer at 0x5604d811dec0, internal representation 0x5604d8185680:(nil), no string representation | |
% set l [list foo bar] | |
foo bar | |
% tcl::unsupported::representation $l | |
value is a list with a refcount of 3, object pointer at 0x5604d81b6190, internal representation 0x5604d8185480:(nil), string representation "foo bar" | |
% list length $l | |
length {foo bar} | |
% llength $l | |
2 | |
% llength [set l2 [list a b]] | |
2 | |
% tcl::unsupported::representation $l2 | |
value is a list with a refcount of 3, object pointer at 0x5604d81b67f0, internal representation 0x5604d8186480:(nil), no string representation | |
% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment