3 ms·
I believe the point is that the bytecode 'knows' the context the value will be delivered to, which is the interesting thing that separates this from most other
by zwischenzug 9y ago
I believe the point is that the bytecode 'knows' the context the value will be delivered to, which is the interesting thing that separates this from most other languages. From the README:
This is somewhat interesting. You can't use frames to differentiate between puts [schro] and schro, as they're both in the same frame. In fact, in the general case for a programming language, this is impossible - it would depend on using an oracle to predict what's going to happen to the value you return.
Happily, in Tcl we can cheat! There are three vital points - 1. Tcl compiles lines passed into the repl to bytecode, 2. Tcl bytecode is a stack machine and 3. Tcl has a pointer to the current execution location in the bytecode (note that point 1 only became true in Tcl 8.6 (I believe) so this code won't work before then).