2025-06-02
Unlike 0.7.1, 0.7.2 is not about big new features, instead it is laser focused on adding quality of life improvements, which are backwards compatible with other 0.7 releases.
Setting a variable at compile time can now be simplified using compile time logical or |||
and compile time logical and &&& with a variable right hand expression.
The original code to set a variable at compile time:
$if FOO: bool x = true;$else bool x = foo();$endifNow this compile time variable can be set with compile time logical or ||| compactly as:
bool x = FOO ||| foo();You can also use compile time logical and &&& in a similar way.
@rndSometimes it can be useful to create unique ids at compile time. This is now possible with the @rnd macro.
math::@ceilIt is somewhat hard to write a good compile time ceil function, so 0.7.2 adds a builtin which is accessible using the math::@ceil macro.
To make c3c run and c3c compile-run more convenient, it’s now possible to use --run-dir (or the project setting run-dir) to set the director from which the compiler runs the resulting binary.
Limitations of vectors are sometimes misunderstood, they will cause code bloat if used for large vectors. For this reason a max vector size has been introduced. By default this is 4096 bits, so basically the size of double[<64>]. It is possible to increase this using --max-vector-size as needed. (As a comparison, the biggest SIMD vectors on x64 is 512 bits, so such a 4096 bit vector would be represented by 8 registers).
has_tagof works on builtin typesWhile has_tagof will always return false on builtin types, this change nonetheless simplifies writing compile time code involving tags.
To simplify generic module resolution it was not possible to recursively generate generic module. This restriction has been lifted in 0.7.1.
The bitsize suffixes are deprecated, so rather than writing 23u64 use the C style 23UL instead. u128 and i128 suffixes are replaced by ULL and LL suffixes.
Finally, the d suffix for doubles have been added as a complement to f.
MyEnum.elements have been deprecated. Use MyEnum.len instead.
SomeFn.params have been deprecated. Use SomeFn.paramsof instead.
@param docsBy 0.7.1 the declaration style @param foo "abc" would be allowed rather than @param foo : "abc". This was by accident. It’s now properly deprecated.
Creating faults that are parameterized is usually a mistake and should not have been allowed. It’s been completely removed in 0.7.2 as it was classified as a bug.
This is no longer allowed:
module Foo {Type};typedef BAZ, HELLO;Faults should be defined in a non-generic module, such as a parent module or sub-module instead.
This release contains about 30 different fixes, most of them newly discovered and not regressions.
They range from fixes to advanced generic types to stdlib bugs.
Currently a new version of the matrix library is incubating, and while it didn’t make it for the 0.7.2 release, I hope it can be included by 0.7.4 and contributions are welcome!
String -> ZString conversionsSometimes a String is already pointing to a valid ZString, so no copy is needed. To check this, String gets two new methods .is_zstr to check if the String is also zero terminated, and .quick_zstr which will create a temp ZString if needed, but otherwise use the String.
std::ascii moves into std::corestd::ascii moved into std::core::ascii. Old _m variants are deprecated, as is uint methods.
It’s now possible to further customize tokenization, to ignore empty elements in the middle (or not), ignore any last empty elements at the end (or not). This introduces .tokenize_all which replaces the now deprecated .splitter method.
String further gets some conveniences: .count to count the number of instances of a string within the string and replace / treplace to return a new String with a substring replaced. This functionality was already in DString, but was now added to String as well.
Duration * Int, Clock - Clock and DateTime + Duration overloads were added for manipulating time.
For Maybe, the == operator is available when the inner type is equatable.
Subprocess added an inherit_stdio option to inherit the parent’s stdin, stdout, and stderr instead of creating pipes.
--run-dir, to specify directory for running executable using compile-run and run #2121.run-dir to project.json.quiet to project.json.||| and &&& be runtime values.@rnd() compile time random function (using the $$rnd() builtin). #2078math::@ceil() compile time ceil function. #2134MyEnum.elements.SomeFn.params.has_tagof on builtin types.@jump now included in --list-attributes #2155.$$matrix_mul and $$matrix_transpose builtins.d as floating point suffix for double types.f32, f64 and f128 suffixes.@param foo "abc".--header-output and header-output options for controlling header output folder.int[2] to uint[2] #2115foo(); where foo() returns an untyped list. #2117[:^n] #2123.@attrdef Foo = ;.ABC = { 1 2 } was accidentally allowed.Foo{int}**** #2140.{} would overwrite the parent field.&&& was accidentally available as a valid prefix operator.--path does not interact correctly with relative path arguments #2149.@noreturn to os::exit.$$sat_mul was missing.for with incorrect var declaration caused crash #2154.[out] and & params. #2156.#foo arguments with $defined #2173String.quick_ztr and String.is_zstrString.tokenize_all to replace the now deprecated String.splitterString.count to count the number of instances of a string.String.replace and String.treplace to replace substrings within a string.Duration * Int and Clock - Clock overload.DateTime + Duration overloads.Maybe.equals and respective == operator when the inner type is equatable.inherit_stdio option to SubProcessOptions to inherit parent’s stdin, stdout, and stderr instead of creating pipes. #2012cleanup parameter in os::exit and os::fastexit.extern fn ioctl(CInt fd, ulong request, ...) binding to libc;Check out the documentation or download it and try it out.
Have questions? Come and chat with us on Discord.