Not C. Not Erlang. Just elang.
elang is a systems language derived from C that adds modern, useful features.
C is a popular language. It's used for embedded systems around the world. However, sometimes engineers can feel discouraged by C's lack of modern features.
Software developers can use elang as a replacement for C. Why would they? elang has an additional feature called when
. This is advantageous, because it optimizes for readability in a growing codebase.
Instead of checking a variable's state after each mutation, when
statements hook into and monitor the state of the program to execute the body of the when
statement automatically.
elang brings all of the power of C to a language that is easy and natural to write and reason about.
#import <stdio>
string fizz = "Fizz";
string buzz = "Buzz";
string fizz_buzz = "Fizzbuzz";
// Classic - fizzbuzz!
int main() {
int count = 0;
when(count % 15 == 0) {
puts(fizz_buzz);
}
when(count % 5 == 0) {
puts(buzz);
}
when(count % 3 == 0) {
puts(fizz);
}
when(count % 15 != 0 && count % 5 != 0 && count % 3 != 0) {
printf("%i\n", count);
}
while(count <= 100) {
/*
We're now watching the state of x,
so all we have to do is mutate it!
*/
count = count + 1;
}
return 0;
}
Take the above FizzBuzz example and save it in a file called fizzbuzz.e - it is very important that the file's extension is .e! Once you've done so and ensured that you have installed the compiler with the install script (found here), run the following command:
elangc fizzbuzz.e fizzbuzz
That's it! An executable with the name specified as the second argument will be placed in the directory that you run the command, and can then be executed as normal.