Updated 2007-11-16 16:41:28 by dkf

Under which circumstances is bytecoding done? It is not as simple as "procs are bytecoded". This page informs about details and peculiarities, only seen from the view of the programmer who wants to know when a script is bytecoded and when not. -- RJM

See also Proc to bytecodes: when, how does it happen

proc does bytecoding.

However, any eval or uplevel prefixed scripts are not bytecoded. As a consequence, it is not recommended to start a proc body with an uplevel for the whole body if is intended to share all variables with the caller's scope. Instead it is better to explicitly share variables with subsequent upvar var var commands.

Loops as while or for do not bytecompile outside of procs (an assumption at the top of "Playing bytecode".

It is said here (Many ways to eval), that interp eval {} ... does bytecoding.

RS: if 1 {...} is the byte-coded equivalent of eval ... TV That's funny. RJM: but it does not concatenate. So a script containing a list which must appear as words to a command can not work using this trick.

EB: It may also be useful two know when bytecode in invalidated. For example, renaming or deleting a command that generate bytecode (such as set) invalidate bytecode.