Is it transcoded down to C and compiled?
Vimscript is interpreted, and in fact you can do basically the same things in vimscript as you could at the
: command (and the other way around), plus or minus some bar and escape characters to make things sane.
The evaluation code is mainly located in
eval.c, which you can browse if you are brave.
Is it put on the heap at runtime and referenced through a function
While a built-in function is ultimately a function pointer to the C implementation, a user function is represented by a
ufunc_T structure (trimmed of some stuff for brevity):
call_user_func is used to actually make the call to a user function. After doing a ton of setup to initialize arguments, variables, profiling information and state management,
do_cmdline(NULL, get_func_line, (void *)fc, DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT);
to execute each line of the function as a
: command line (the implementation of
do_cmdline in in ex_docmd.c).