An experimental modern high-performance programming language that emphasizes simplicity, expressivity and memory safety.
Reflect makes all common programming styles feel effortless. Functional, procedural and object oriented approaches can all play out their strengths and integrate seamlessly.
Meta programming feels as natural as writing ordinary code - no templates, no macros, no compiler plugins. Call any function at compile time, work with types as if they were ordinary values, and generate code with simple meta control flow statements.
The language is currently in an experimental state, exploring and refining the core design decisions.
Start Experimentingfunction main()
{
print("Hello, World!");
// declare some constants
let x = 3, y = 4;
// format using string interpolations
print("$(x) × $(y) = $(x * y)");
}Output:Hello, World! 3 × 4 = 12
Similar to C++, D or Rust, Reflect is a multi-paradigm language. There is an emphasis on functional programming, but imperative and object oriented styles can be mixed seamlessly, making it possible to use the strengths of each approach where they fit best.
Event though the current experimental compiler still executes code using its built-in interpreter, the language will be fully compiled to machine code in the future, reaching the same performance levels as C/C++.
The language syntax has been carefully designed to minimize uneeded punctuation and grammatical overhead. Sensible default choices and strong type inference result in code that is focused on the actual intent, instead of being littered with semantic hints to the compiler.
Instead of separating normal programming from meta programming, compile-time operations are a seamless extension to the normal runtime code. Any pure function can be executed at compile time and types are ordinary values that can be constructed using normal expressions.
Instead of a separate template concept, functions can accept compile-time “meta” parameters, which can then be used to generate code or to define new user defined types. Compile-time loops and conditions, together with procedurally defined identifiers are used to generate code in a completely natural way, eliminating the need for external code generators.
The type system guarantees memory-safety by catching out-of-bounds accesses, null pointer dereferences, data race-conditions, use-after-free and other possible sources for memory corruption.
Memory allocations are managed using movable isolated references or automatic reference counting. If needed, `@unsafe` statements can be used to work with bare-metal pointers, enabling completely manual memory management, as well as implementing custom memory-safe reference types.