3 ms·
> "Everything is a string" kinda puts people off. I can't speak for "people", but i think this might be a bit of misunderstanding combined w an implementation
by bch 3y ago
> "Everything is a string" kinda puts people off.
I can't speak for "people", but i think this might be a bit of misunderstanding combined w an implementation detail.
I think most Tcl people these days would say "everything is representable as a string", which is to say types can be marshalled back/forth through a string representation. This (with other features) allows Tcl to be homoiconic[0] (it can evaluated the symbols it emits itself). Pre-8[1] (1997/1998(?)) Tcl internals did also indeed use char* strings to do its own work parsing/evaluating, but Tcl8 brought in so called Tcl_Obj structures w "dual ported" values that keep the iconic string representation available, as well as a native value (ie: integer when using the value as an integer, so you wouldnt need to do something like atoi() on a string rep when you wanted to do math).
[0] https://en.wikipedia.org/wiki/Homoiconicity https://en.wikipedia.org/wiki/Homoiconicity
[1] https://tcl.tk/software/tcltk/8.0.html https://tcl.tk/software/tcltk/8.0.html
- IshKebab 3y agoSemantically everything is a string, even if they have performance optimisations to make that slightly less insane. Performance is only one of the issues with "everything is a string". Bug-proneness is probably a bigger issue and you can't fix that with optimisations.