Skip to main content

Why East?

Elara was created to provide a platform for solving complex business problems. The Elara platform blends together some of the most demanding technologies in computer science: data integrations and pipelines, simulation, machine learning, mathematical optimization and visualization. And each solution incorporates data and logic specific to the problem being solved. To enable all of this safely and at full speed, it required that something be created.

The challenges

Creating a platform like Elara is no easy feat due to three primary challenges.

Challenge #1: Complexity

Real-world businesses and organisations are full of complexity, much of it essential to the task at hand. An overly simplistic system would not be able to handle realistic problems. Elara needs to be able to handle complex, nested data and perform sophisticated custom logic without overwheling developers. Ultimately, Elara needs to allow solution developers to simplify the solution without unrealistically simplifying the problem.

Challenge #2: Portability, safety and reliability

A safe, secure and stable platform is required for hosting solutions. User-written logic needs to sent to the Elara platform as a part of the solution template. And any of this provided logic must not compromise security when executed, and should not be able to crash or freeze the servers. Thus the technology used for executing user-provided logic must be carefully chosen.

Challenge #3: Performance

Elara needs to deliver world-class performance to solve complex mathematical problems in a timely manner. Our simulations, optimizations and data pipelines have custom logic embedded from the solution template. Its important to provide a way of executing this logic without resorting to slow code interpretters or launching a separate execution context. Ideally, your logic is executed inline as native code for the full performance you could expect from a hand-written C/C++ program.

The solution

To solve these challenges, the East data model and expression language was created. By designing this from first principles it is possible to ensure:

  1. Nested data and complex logic is supported, and expressions can be easily sent to Elara as JSON.
  2. Expressions cannot have undesirable side-effects and always terminate.
  3. Logic can be compiled to native code and inlined within our algorithms safely.

During the design process, there was also the goal of keeping the type system and expression language minimal, and to provide excellent integration with the TypeScript-based Elara Development Kit (EDK).

For the technically minded, East is a total functional programming language with a rich and strong structural type system that makes extensive use of flow typing for ease of usage. The name "East" was chosen because a prototype of our JSON-based expressions was called the "Elara AST" (abstract syntax tree) and the acronym stuck.

East values and types

The East data model and type system is an integral part of the Elara platform. All data stored and transmitted within Elara is always statically typed with an East data type. Similarly, each value within an expression has a known East type.

A variety of primitive types necessary to model businesses are supported - included Booleans, integers, floats, strings, datetimes. Complex data can be nested inside structs, variants arrays, sets and dictionaries. Even binary blobs, useful for modelling anything from a file to a docker image, are permissible.

However, East does not support nominal types or object-oriented classes. Data is structurally typed, similar the schema of a SQL database. For example, the rows of a table are defined as a struct of fields, and a table is a collection (e.g. array or dictionary) of rows. Two structs with the same set of fields and types are always considered to be of the same type - and thus can be compared or used interchangeably. The reason for using a structural type system is it enable great simplicity while still providing the safety guarantees and performance characteristics of static type systems.

Another aspect of structural typing is it enables simple binary and JSON-like representations of data, with no need for constructors, explicit type annotations, and other complications. For example, a simple two-column table may be printed like:

[ 
(id=1, name="Alice"),
(id=2, name="Bob"),
(id=3, name="Charlie"),
]

Elara also supports a JSON encoding of every possible East value to enable interoperability, like:

[ 
{ "id": "1", "name": "Alice" },
{ "id": "2", "name": "Bob" },
{ "id": "3", "name": "Charlie" }
]

The full set of East types are described in the next unit. The goal of the data model is to be as complex as necessary but no more. Elara enable developers to solve business problems as simply as possible.

East expressions

The East programming language has several features intended to make it simple and easy to use.

Expression based

The East programming language is a small expression-based language. This means all valid code evaluates to a value. (In contrast, many languages support statements that cannot be assigned to a variable, or functions that return the type void or never.)

Strongly typed

East has a strong, static type system. The type of every expression and variable is statically known. The types of expressions and subexpressions are checked at compiled time to gurantee correctness.

These features mean that users don't need to worry about entire classes of programming bugs, while East expressions can be compiled down to tight, native code for optimal performance.

Total functional language

East is a functional language. Every value is constant and cannot be mutated within the expression. Programmers can avoid worrying about complex behavior that can result when something is mutated from afar. Operators do not need to worry about low-level pointer manipulation causing undefined behavior or security vulnerabilities.

Furthermore, it is impossible to construct code that never terminates, such as an infinite loop. This makes a "total" language, where every expression always returns a result. (There is an exception to this as expressions are allowed to result in an error, halting the task they are run in).

These features mean that its possible to evaluate user-defined expressions on the Elara platform without risk of security breaches or concerns about code never halting (though timeouts are provided at the task level regardless).

Simple and familiar

In many ways, East expressions are similar to those that are found in Excel. This is because the design constraints are similar in both contexts. In both Excel and Elara user-provided logic needs to be evaluated safely and without suprising side-effects. Both provide simple expression langauges that are easy for users to enter. Complex programs are composed of many simpler expressions working together. At times, they even superficially resemble each other. Consider this Excel expression:

IF(A1, B1 + B2, C1)

You can write a similar East expression in our TypeScript interface for East as:

IfElse(a, Add(b1, b2), c)

East consists of a relatively small number (about 100) of possible operations, making it a small language. At this time it does not support first-class functions (i.e. functions as values) but higher-order functions are possible to simulate.

Next steps

Now that you understand why East exists, continue to the next tutorial to understand the different types of data that you can use with East and Elara.