ERights Home elang 
Back to: QuasiLiteral Expressions and Patterns 1st child: Control Flow Expressions On to: Kernel Reference

Block Structure


As in many C tradition languages (C, C++, Java, Perl, Python, Tcl, and csh), E statements and expressions appear only inside function and object definitions. Actually, E has no statements -- only expressions. The control-flow constructs, like the if expression, that one might expect to be statements are instead expressions in E.

The next chapter, Control Flow Expressions , covers the ones most like traditional control-flow. The following chapter, The for Loops, covers E's main iteration construct. Then, in The define Expressions , we see how to define new variables, functions, normal objects, and message plumbing objects. Finally, Inheritance by Delegation , introduces the class expression, which supports a pattern of delegating messages that mirrors the conventional notion of inheritance.

Quick Links to Sequential E Control Structures

Control Flow Expressions

if (cond) { then-expr } else { else-expr }
left && right
left || right
{ nested-expr }
escape hatch { body }
while (cond) { body }
try { attempt } catch ex { handler } finally { exit }
switch (specimen) { match pattern { body } ... }

The for Loops

for value-patt in collection { body }
for key-patt => value-patt in collection { body }

Defining...

variables:   def pattern := expr
functions:   def name(patterns) guard { body }
objects:   def name { methods matchers }
... by delegation:   def name extends expr { methods }
plumbing:   def name match pattern { body }

 

Inheritance by Delegation

def self extends abstrastFoo(self, ...) { ... }

 

 
Unless stated otherwise, all text on this page which is either unattributed or by Mark S. Miller is hereby placed in the public domain.
ERights Home elang 
Back to: QuasiLiteral Expressions and Patterns 1st child: Control Flow Expressions On to: Kernel Reference
Download    FAQ    API    Mail Archive    Donate

report bug (including invalid html)

Golden Key Campaign Blue Ribbon Campaign