4 ms·
Tcl 8 introduced dual-ported objects. Everything can exist as a typed object that is convertible back to a string in certain cases (some form of string operatio
by kevin_thibedeau 5mo ago
Tcl 8 introduced dual-ported objects. Everything can exist as a typed object that is convertible back to a string in certain cases (some form of string operation typically). That plus the bytecode engine makes it work completely different than prior releases.
- IshKebab 5mo agoThat's just a performance optimisation. It doesn't change the semantics at all. From the changelog: > Tcl automatically manages these values so their type is transparent to the Tcl script writer. https://www.tcl-lang.org/software/tcltk/whatsnew.tml https://www.tcl-lang.org/software/tcltk/whatsnew.tml
- kevin_thibedeau 5mo agoSaying it's "just strings" is disingenuous. You could make a js interpreter that uses strings internally too.
- IshKebab 5mo agoNo. Tcl is all strings from a language point of view. To your Tcl code, everything is a string. Internally in the main Tcl implementation, it isn't just strings. It's a bit cleverer so it can be faster. But that is completely invisible to the Tcl programmer. JavaScript is not just strings. It has real types (even if it is happy to coerce them to strings at the drop of a hat). To put it another way, JavaScript has `typeof` which returns the type of an object. Tcl doesn't have that because the answer would always be "string".
- kevin_thibedeau 5mo agotcl::unsupported::representation will expose the actual internal type.
- IshKebab 5mo ago> ::tcl::unsupported is a namespace that contains bits and pieces of Tcl that are experimental, not intended for production code, perhaps useful for debugging and introspecting Tcl, and liable to change or removal without warning.