Declare functions on demand; process annotations in runtime

The runtime interface now uses the same code path for resolving
functions, which enables processing of attributes/annotations in
the source just as when compiling packages.