-
Notifications
You must be signed in to change notification settings - Fork 7
Compile
btiffin edited this page Dec 21, 2011
·
6 revisions
compile source /at context /reset
Compiles a function or block to executable code.
compile is a function!
source -- [function! block!]
/at -- Choose a context for compilation
context -- Reference to the target context [context! word! block!]
/reset -- Reset the compile state
w> c: [a: 2 b: 20 a + b]
== [a: 2 b: 20 a + b]
w> disasm c
** Script error: block hasn't been compiled yet
** Near: disasm c
w> compile c
== [a: 2 b: 20 a + b]
w> disasm c
0 LOADK 0 2
1 SET_TVALUE 90ee53808db2588 0
2 LOADK 0 20
3 SET_TVALUE 2108dab958 0
4 GET_TVALUE 0 8db2588
5 GET_TVALUE 1 24908dab958
6 ADD 0 0 1
7 END 0 Note that compile does not actually evaluate the expressions, but creates the World Virtual Machine instructions.