Next: , Previous: , Up: Objects   [Contents][Index]


5.1.2 Synchronous calls

Relative to a given vat, there are two types of objects. A near object is in the vat. A far object is in a different vat. Similarly, there are two ways to invoke objects: synchronously, or using traditional call-return, which only works for near objects; or asynchronously, which works for either near or far objects, and usually returns a promise. Synchronous and asynchronous invocation use different but similar procedures.

Procedure: $ to-refr args …

Call a near object’s behavior and return the result.

  • to-refr: Near object to call.
  • args: Arguments to the object’s behavior. If to-refr has methods, the first argument will conventionally be a symbol indicating the behavior/method to be invoked.
(define object-a (spawn ^some-object))
;; in the same vat
(define a-val ($ object-a arg1))
(define b-val ($ object-a 'some-method arg2))