Vat
From Erights
(Difference between revisions)
Kevin Reid (Talk | contribs) (link to non-wiki) |
(Created seedVatAuthor example) |
||
| Line 1: | Line 1: | ||
See [http://www.erights.org/elib/concurrency/vat.html]. | See [http://www.erights.org/elib/concurrency/vat.html]. | ||
| + | |||
| + | |||
| + | ==Example: How to create a new Vat== | ||
| + | <pre> | ||
| + | introducer.onTheAir() | ||
| + | # value: ["3DES_SDH_M2", "3DES_SDH_M"] | ||
| + | |||
| + | ? def seedVatAuthor := <elang:interp.seedVatAuthor>(<unsafe>).virtualize((introducer)) | ||
| + | # value: <virtualSeedVat> | ||
| + | |||
| + | ? def scriptSource:="def run(thing) {println(`Thing: $thing`)}" | ||
| + | # value: "def run(thing) {println(`Thing: $thing`)}" | ||
| + | |||
| + | ? def [scriptObj, vat] := seedVatAuthor(scriptSource) | ||
| + | # value: [<Promise>, <Vat newVirtualSeedVat in <runs in newVirtualSeedVat>>] | ||
| + | |||
| + | ? scriptObj<-run("Hello Vat") | ||
| + | # value: <Remote Promise> | ||
| + | |||
| + | ? Thing: Hello Vat | ||
| + | </pre> | ||
Revision as of 11:34, 21 April 2007
See [1].
Example: How to create a new Vat
introducer.onTheAir()
# value: ["3DES_SDH_M2", "3DES_SDH_M"]
? def seedVatAuthor := <elang:interp.seedVatAuthor>(<unsafe>).virtualize((introducer))
# value: <virtualSeedVat>
? def scriptSource:="def run(thing) {println(`Thing: $thing`)}"
# value: "def run(thing) {println(`Thing: $thing`)}"
? def [scriptObj, vat] := seedVatAuthor(scriptSource)
# value: [<Promise>, <Vat newVirtualSeedVat in <runs in newVirtualSeedVat>>]
? scriptObj<-run("Hello Vat")
# value: <Remote Promise>
? Thing: Hello Vat

