cx is a language designed for performance and productivity.
cx is a hybrid low-level / high-level programming language focused on runtime performance and developer productivity, in this order of priority. The language is simple and unopinionated, has a clean C-like syntax, and supports imperative, generic, data-oriented, functional, and object-oriented programming.
// Filter and transform a list.
void main() {
var doubled = List([0, 1, 2, 3, 4]).filter(isEven).map(n => n * 2).toList();
println(doubled); // [0, 4, 8]
}
bool isEven(int n) {
return n % 2 == 0;
}Performance
cx compiles to efficient native code using LLVM. There's no garbage collection, hidden allocation, or runtime. cx takes a performance-first approach to common programming patterns, such as subtyping (tagged unions), map/filter/reduce (lazy iterators), and string/array handling (slices). Even fast compilation is a goal of cx.
Expressiveness
cx is a simple yet expressive language, featuring a strong type system with compile-time null-safety, sum types, and trait-like interfaces. It has both high-level programming constructs and support for systems-level programming, such as pointers, destructors, and generics. There are no preprocessor or macros.
Productivity
cx has great C interop: C headers can be imported directly without the need for bindings. The clean and familiar C-like syntax avoids unnecessary boilerplate, and allows C/C++ programmers to instantly get productive without a steep learning curve. Debug builds check for buffer or arithmetic overflows by default.