Introduction
Jazz is a fast and modern systems programming language designed for game and desktop programs development. Language inspired by C++,Swift,Vala and Rust and main goals is memory safety and compile-time execution.
Why use Jazz?
Build system and package manager
Build system and package manager included into compiler, you can just use jazz new <package name>
command to create new project. To import some dependency you can add it's description in build.jazz
file:
var dependencies = [
(package: "Example",version: " 0.0.1",git: "https://github.com/user/Lib")
];
Compile-time execution
Jazz allows you to execute a lot of code in compile-time context. This feature allows you to detect something at compile-time instead of run time, for example bit_cast
function from standard library uses compile-time assert
to throw error at compile-time:
fun bit_cast<T,U>(val: T): U {
comptime {
assert(sizeof(T) == sizeof(U));
}
...
}
Compile-time reflection
You can iterate over enumeration values, get structure methods and fields and etc. You can do a lot of things with reflection in Jazz,just a simple example:
fun fields_string<T>(): Array<String> {
assert(@isStruct<T>());
var fields = @getFields<T>();
var array = Array<String>(cap: fields.size());
for (const field in fields) {
array.push(field.name);
}
return array;
}
Last updated
Was this helpful?