Implement Tcl in Tcl (2007)

The question being pondered is how much of Tcl can be implemented in Tcl itself. It is acknowledged that system calls cannot be implemented, but nearly everything else can. The author lists commands and parts of Tcl that would be in the minimal set, including “set,” “eval,” “unknown,” “string index,” “string length,” “lindex,” “llength,” and “list.” Other things that could be simulated in Tcl include interpreters, namespaces, expr, callstack, proc, if/while/switch/for/foreach, regexp, package system, traces, event loop, and glob. The author does not expect expr and regexp to be easy to implement. The author also mentions that other languages, such as C, Python, and Smalltalk, are self-hosting, but expects that a TclTcl implementation would be slow but interesting and easy to port to embedded systems. The author shares their own implementation of a subset of Tcl in Tcl, which they describe as quite portable. They also outline some key differences between their implementation and traditional Tcl, including the lack of support for “expr,” different syntax for conditionals, lack of arrays and namespaces, and differences in what is considered false and true. The author notes some

https://wiki.tcl-lang.org/page/Implement+tcl+in+tcl

To top