E

From Esolang
Jump to navigation Jump to search
Not to be confused with E (eeEee).
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
E
Designed by Miller et al.
Appeared in 1996
Computational class Turing-complete
Reference implementation E-on-Java 0.9.3d
Influenced by Joule, Java
Influenced Monte
File extension(s) .emaker

E is an object-capability language designed by Mark S. Miller in 1996 and implemented at Electric Communities by a team including Miller, Dan Bornstein, Chip Morningstar, and Douglas Crockford in 1997. It is notable for refining the unification of objects, capabilities, and actors pioneered by Joule; in E, a reference to an object is a capability to send messages to that object, and every object may be invoked asynchronously like an actor. E also introduced the concept of E-ordering of messages.

Hello World

The hello-world of object-capability languages is the following example, called "Simple Money" in Capability-based Financial Instruments but often unofficially called "The Mint".

def makeMint(name) :any {
    def [sealer, unsealer] := makeBrandPair(name)
    def mint {
        to __printOn(out) :void { out.print(`<$name's mint>`) }
        to makePurse(var balance :(int >= 0)) :any {
            def decr(amount :(0..balance)) :void {
                balance -= amount
            }
            def purse {
                to __printOn(out) :void {
                    out.print(`<has $balance $name bucks>`)
                }
                to getBalance() :int { return balance }
                to sprout()     :any { return mint.makePurse(0) }
                to getDecr()    :any { return sealer.seal(decr) }
                to deposit(amount :int, src) :void {
                    unsealer.unseal(src.getDecr())(amount)
                    balance += amount
                }
            }
            return purse
        }
    }
    return mint
}

Running E

Grab a pure-Java tarball like E-purej-0.9.3d.tar.gz from erights.org and extract it to a directory of your choice. Install a JRE (Java runtime environment) and also rlwrap. Then open a shell in the extracted directory and run:

$ rlwrap ./rune
?

You should get a "?" prompt. Try some arithmetic:

? 1 + 1
# value: 2

Related Links