[e-lang] Some questions

Mark Miller erights at gmail.com
Mon Dec 18 05:30:46 CST 2006


All examples shown here are known to be valid only for E-on-Java.
Kevin, please comment on any differences from E-on-CommonLisp. Thanks.

On 12/18/06, Martin Scheffler <wooyay at web.de> wrote:
> 1. Is there example code on how to spawn a new vat? (There seems to be
> some example code under com.skyhunter.e.lang, but it appears to be
> stale)

    ? def makeVat := <unsafe:org.erights.e.elib.vat.makeVat>
    # value: <makeVat>

    ? def vat := makeVat.make("headless", "testvat")
    # value: <Vat testvat in <runs in testvat>>

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

    ? def counterSrc := "
    > var count := 0
    > def counter {
    >     to incr() { return count += 1 }
    > }"
    # value: "
    #        var count := 0
    #        def counter {
    #            to incr() { return count += 1 }
    #        }"

    ? def distCounter := seedVat(vat, counterSrc)
    # value: <Far ref>

    ? def x := distCounter <- incr()
    # value: 1

    ? def y := distCounter <- incr()
    # value: 2

The fact that the above calls show the results already resolved is due
to a (mostly harmless) race condition bug in the boot-comm system.
Really, in the same turn it should show only promises, and only in a
later turn should you see what they resolve to. Since this is a race
condition, do not be alarmed if you see the correct behavior rather
than what's shown above.


> 2. Can I later kill that vat from outside?


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

    ? interp.waitAtTop(ack)

The "interp.waitAtTop(ack)" pauses the progress of your command-line
session until the ack promise is resolved. If it resolves to
non-broken, then the vat should be shutdown.

    ? def z := distCounter <- incr()
    # value: <ref broken by problem: because I said so>


> 3. What is "DeepFrozen" ?

A guard and auditor for ensuring that a value is transitively
immutable. As a guard, it works in both E-on-Java and E-on-CommonLisp.
As an auditor, it is currently only working in E-on-CommonLisp.


> 4. Is there a description of the caplet interface?

MarcS?


> 5. Where can I find the "CapLauncher" as described in
> http://www.eros-os.org/pipermail/e-lang/2006-August/011467.html?

The actual launcher is in the source tree at

     src/esrc/scripts/capletLauncher.e-awt

However, to launch a caplet, you need merely give it a ".caplet"
extension, make it executable, and put

    #!/usr/bin/env rune

at the top of the caplet file. Additionally, on MSWindows, you can
launch caplet files by double clicking on them. In both cases, rune
dispatches on the ".caplet" extension to feed it to
capletLauncher.e-awt for you.


> 6. Mobile code: Is there a good reason against letting untrusted users
> simply upload code to a machine as a string using a message call? If
> the code was eval()ed with a carefully stocked powerbox? Scenario: The
> mobile code will only get access to a println() command to output
> stuff to a window

Not only is there is no reason not to do this, it is exactly the kind
of thing E was built to support. On the #erights IRC channel on
irc.freenode.net, Kevin runs both an E-on-Java command line and an
E-on-CommonLisp command line doing exactly this. Try logging in and
typing

    ? 2 + 3

The initial "?" is a signal to the E-on-Java participant that you're
talking to it.


-- 
Text by me above is hereby placed in the public domain

    Cheers,
    --MarkM


More information about the e-lang mailing list