rchain-community / js2rho

experimental JavaScript to Rholang translator
3 stars 1 forks source link

reify the vat queue for CapTP in rholang #14

Open dckc opened 2 years ago

dckc commented 2 years ago

vats are islands of synchrony. translated js functions should grab a lock on the vat queue.

this should help with #10 too.

I wonder if it helps channels match with promises better. (e.g. a promise can have multiple .then functions waiting. A channel can too, but only one of them runs on put)

Each time around the loop, the Vat-thread extracts a pending delivery from the queue, and calls the recipient with the message. This top-level call executes to completion before the next pending delivery is processed. The synchronous computation performed in service of a single pending delivery is a turn. -- The Vat

Hm... vat turns are supposed to be transactional too. No messages can be released until state is committed, lest we suffer hangover inconsistency.