!!! Naive Caching Approach

~JavaScript only has one kind of callable object, functions, and already has very flexible field access semantics.
Orc fields are implemented directly as JavaScript fields.
Orc calls are supported by a runtime function {{prepareCallable}} which takes an object and adds a method {{orcCall(handle, args...)}}.
{{orcCall}} invokes the function in an Orc context (handling possible blocking and the like).
Native Orc sites can set {{this.orcCall = this}}.

{{prepareCallable}} can no-op on all objects it has already been called on.
It can also be extended to handle any kind of JavaScript object that should appear callable to Orc programs.

''Note'': Unlike the ~JavaScript API this does not allow multiple dispatch at external site calls.
This matches the semantics of ~JavaScript in which the sites will be implemented.

!!! See Also

* [JVMExternalAPI]