Introduction to Silex

Silex offers modern language features to programmers concerned with performance and precision. Its compiler generates top-performing code and also provides safety and quality analyses. The language follows strict Functional Programming principles while retaining practicality. Graphical development tools also offer direct insights on your code and quick interactive experimentation.

Main direction

The core of a typical Silex application is a composition of pure functions, like arithmetical expressions. The inputs and outputs from this core are statically-sized stack-allocated values. The initial versions of Silex are absent of dynamic allocation.

In a typical function values are computed once and never change. Variables are optionally supported. Only numerical base types are supported at first, along with multidimensional Arrays and Views. Users can also define aliases, algebraic data types and opaque data types.

Methods and functions

Silex methods support ad-hoc and parametric polymorphism (i.e. overloading and templates). Method resolution and specialization leverges anatimorphism (duck-typing).

There are three forms of method declaration in Silex: def, fun and gen methods. Methods can be oveloaded according to parameter types and arity. Names are exclusive for each method type:

  • def-methods — Allow imperative programming. Procedures. while, foreach. def main, def firetherockets.
  • fun methods — Proper pure Functions. map, sum, for...yield. fun squared, fun rad2deg, fun fibonacci.
  • gen methods — Pure except for supporting assignment to locations specified by the caller with exclusive access. Method resolution also depends on output type. gen parse, gen convert, gen zeros
    • In a place-gen, a named output binds to place defined in the caller.
    • A value-gen is like a fun, except for the method resolution.

Functional combinators

Silex emphasizes the fact most programming can be done with either pure function calls or functional combinators that traverse sequences.

In the imperative programming paradigm that was prevalent at the dawn of computing programmers were known to make frequent use of mutation (re-assignment of variables) and of statements such as for-loops, while-loops or even go-to.

The discovery of Functional Programming meant much programming can be carried out in a more constrained and precise way. FP allows us to reason about programs more like arithmetics rather than the temporal physical processes that happen in the underlying machine.

Walking the strict FP path can sometimes be challenging for programmers unfamiliar with it, but it provides the tools to prevent many ails encountered in complex software including invalid memory accesses and application of invalid inputs to partial domain functions.

The high-level and precise semantics of Functional Programming enable powerful compiler optimizations and guarantees about the behavior of the generated code. Silex is the next step to bring this treasure of programming language theory closer to practical application by developers who praise effective and efficient code.