Skip to content

Instantly share code, notes, and snippets.

@kumavis
Created May 5, 2025 10:16
Show Gist options
  • Save kumavis/e49e5ba4b298cae6684d4de320574748 to your computer and use it in GitHub Desktop.
Save kumavis/e49e5ba4b298cae6684d4de320574748 to your computer and use it in GitHub Desktop.
attempt to demonstrate desc:answer lacks an inverse representation in OCapN
(define-values (a-vat a-netlayer a-mycapn)
(make-new-node "a"))
(define-values (b-vat b-netlayer b-mycapn)
(make-new-node "b"))
(define (^greeter _bcom our-name)
(lambda (their-name)
(format #f "Hello ~a, my name is ~a" their-name our-name)))
(define (^echo _bcom)
(lambda (something)
something))
(define bob-sref
(with-vat b-vat
(define bob (spawn ^greeter "Bob"))
($ b-mycapn 'register bob 'fake)))
(define echo-sref
(with-vat b-vat
(define b-echo (spawn ^echo))
($ b-mycapn 'register echo 'fake)))
;; ===
;; A calls B's bob
(define answerPromise
;; call without resolving, should get remote promise for answer (?)
(call-with-vat
b-vat
(lambda ()
(on (<- a-mycapn 'enliven bob-sref)
(lambda (bob)
(<- bob "Alyssa"))
#:promise? #t))))
;; A calls B's echo, with the answerPromise
(define result
(resolve-vow-and-return-result
b-vat
(lambda ()
(on (<- a-mycapn 'enliven echo-sref)
(lambda (echo)
(<- echo answerPromise))
#:promise? #t))))
;; When B tries to return "answerPromise", I expect it to fail to serialize correctly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment