Vat

From Erights

(Difference between revisions)
Jump to: navigation, search
m (Example: How to create a new Vat)
(fixed maker/made confusion: the product of invoking seedVatAuthor is seedVat, not seedVatAuthor. also various formatting and style adustments)
Line 4: Line 4:
==Example: How to create a new Vat==
==Example: How to create a new Vat==
<pre>
<pre>
-
introducer.onTheAir()
+
? introducer.onTheAir()
# value: ["3DES_SDH_M2", "3DES_SDH_M"]
# value: ["3DES_SDH_M2", "3DES_SDH_M"]
-
? def seedVatAuthor := <elang:interp.seedVatAuthor>(<unsafe>).virtualize(introducer)
+
? def seedVat := <elang:interp.seedVatAuthor>(<unsafe>).virtualize(introducer)
# value: <virtualSeedVat>
# value: <virtualSeedVat>
-
? def scriptSource:="def run(thing) {println(`Thing: $thing`)}"
+
? def source := "def run(thing) {println(`Thing: $thing`)}"
# value: "def run(thing) {println(`Thing: $thing`)}"
# value: "def run(thing) {println(`Thing: $thing`)}"
-
? def [scriptObj, vat] := seedVatAuthor(scriptSource)
+
? def [farObj, vat] := seedVat(source)
# value: [<Promise>, <Vat newVirtualSeedVat in <runs in newVirtualSeedVat>>]
# value: [<Promise>, <Vat newVirtualSeedVat in <runs in newVirtualSeedVat>>]
-
? scriptObj<-run("Hello Vat")
+
? farObj <- ("Hello Vat")
-
# value: <Remote Promise>
+
# value: <Promise>
? Thing: Hello Vat
? Thing: Hello Vat

Revision as of 03:22, 13 February 2008

See [1].


Example: How to create a new Vat

? introducer.onTheAir()
# value: ["3DES_SDH_M2", "3DES_SDH_M"]

? def seedVat := <elang:interp.seedVatAuthor>(<unsafe>).virtualize(introducer)
# value: <virtualSeedVat>

? def source := "def run(thing) {println(`Thing: $thing`)}"
# value: "def run(thing) {println(`Thing: $thing`)}"

? def [farObj, vat] := seedVat(source)
# value: [<Promise>, <Vat newVirtualSeedVat in <runs in newVirtualSeedVat>>]

? farObj <- ("Hello Vat")
# value: <Promise>

? Thing: Hello Vat

# shutting down the vat
? def ack := vat <- orderlyShutdown("because I said so")
# value: <Promise>

Personal tools
more tools