A statically typed, general-purpose programming language, crafted for simplicity and performance.
"Trust the programmer" - corx
Due to performance reasons, type metadata is only available to specific contexts (where metadata is
available) and some operations are only
permitted in these contexts. For specific types, there are equivalent metadata types. As, for describing
variadic function arguments there is a vargs
type.
typeof
OperatorRetrieves the type ID of a given variable or expression. Useful for runtime type inspection in contexts where type metadata is available.
int x = 42;
if (typeof x == type_int) {
print("x is an integer.");
}
typestr
OperatorConverts a type ID into its string representation for debugging or user feedback purposes.
int x = 42;
print("Type of x: " + typestr typeof x); # Output: "Type of x: integer"
# or for clarity
print("Type of x: " + typestr(typeof x));
foreach
LoopSimplifies iteration over collections or metadata structures like vargs. Works with arrays, metadata types, and other iterable structures.
int sum(int args...) { # variable name, only int type is allowed
vargs data = vainit(args);
int res = 0;
foreach (arg in data) {
print(arg);
}
# automatic cleanup any data existed
return res;
}