E
- Appeared in:
- 1997
- Influenced by:
- Paradigm:
- Typing discipline:
- File extensions:
- .e
- Versions and implementations (Collapse all | Expand all):
E is an object-oriented programming language for secure distributed software development.
E was developed by a team led by Mark S. Miller and Dan Bornstein at Electric Communities in 1997. It is a descendant of Joule (concurrent language) and Original-E (Java extensions for secure distributed computations). E was designed as a scripting language, sacrificing efficiency for ease of use.
The core of the language is ELib — a library which implements interactions between objects and processes of the program. Each objects belongs to some process. Distributed calculations are implemented by sending messages to remote objects (objects which belong to other processes). E provides two ways of sending messages: immediate call (similar to calling a function in other languages — the sender process pauses and waits until the receiver process finishes calculations) and eventual call. An eventual call sends a message to the receiver and creates a temporary object (“promise”) belonging to the sender process. The sender can continue the work immediately using this object as a placeholder. Later, when the receiver processes the message and returns the result, the return value will replace the promise. This mechanism allows to avoid deadlocks and reduces the delays caused by network latency.
The language is designed to ensure security of computations. It implements capability-based object-oriented model, with object reference serving as its capability. All interprocess communication is encrypted by the runtime. The language syntax aims to make auditing as easy as possible; this includes lexical scoping, using ==
for equality check and :=
for assignment, etc.
The syntax reminds that of Java, except for the fact that all programs consist entirely of expressions. Main data types are int
(with long arithmetic), float
, string
, char
and boolean
.
Elements of syntax:
Inline comments | # |
---|---|
Variable assignment | <varname> := <value> |
Physical (shallow) equality | == |
Physical (shallow) inequality | != |
While condition do | while (condtion) ... |
For each value in a numeric range, 1 increment | for i in 1..10 { ... } |
Links:
Examples:
Hello, World!:
Example for versions E-on-Java 0.9.3println("Hello, World!")
Fibonacci numbers:
Example for versions E-on-Java 0.9.3var s := [0, 1]
var res := ""
for _ in 1..16 {
def [a, b] := s
s := [b, a + b]
res := res + b.toString(10) + ", "
}
println(res + "...")
Factorial:
Example for versions E-on-Java 0.9.3E is implicitly-typed language; :int
in function signature is not a type declaration but rather a “guard” — a contract which guarantees that factorial
function will be given only integer arguments and it will return only integer values. Such limitations are not necessary but quite useful for code auditing.
def factorial(n :int) :int {
if (n == 0) {
return 1
} else {
return n * factorial(n-1)
}
}
for n in 0..16 {
println(n.toString(10) + "! = " + factorial(n).toString(10))
}
Comments
]]>blog comments powered by Disqus
]]>