This required a massive cross-cutting rework to the scope system,
multiple subtle bugfixes and relearning of the parser internals, but it
does appear that functions are working correctly.
A few caveats: for now, parameters are always constant, regardless of
type, return values can't be specified, and some script tests have been
written.
Most importantly, a key feature is working: closures.