Quxlang has added a lot of functionality throughout the past few months.
Exceptions work, although they are not currently compatible with C++ exceptions. Maybe I’ll write a follow up on that.
Added built in BENCHMARK declarations with misc syntax.
NOEXCEPT_IF and other misc keywords.
Standard algorithms now include searching, counting, copying/moving, transforms, partitioning, sorting, heaps, binary searches, set operations, permutations and folds. APIs include iterator and borrowed-range forms, projections and comparison callbacks; range overloads reject temporary ranges. sort uses introsort and nth_element uses median-of-medians selection. stable_sort, stable_partition and inplace_merge require caller-provided scratch storage. Supporting types include subrange, back_inserter and scratch_ref. etc…
NEW T COUNT(n) constructs contiguous arrays, with matching DELETE COUNT(n) destroying elements in reverse order. Construction supports per-element initializers, GENERATOR(callable), or inline INDEX(i) DO bodies using INIT. Count and generator expressions are evaluated once; ordinary initializer expressions run per element
Quxlang now has possibly the fastest memory allocator, although it loses to mimalloc in a few specific scenarios (like long chains of allocations followed by chains of deallocations). So far it seems to be the fastest for short lived allocations.
In addition to more robust threading, various algorithms, I’ve also added coroutines.
Quxlang Coroutines are a lower level interface than C++ coroutines, but for convenience, I’ve added std::cpp_style_coroutine_base which allows launching coroutines with C++ style behaviors.
In Quxlang, coroutines and functions can be overloaded together as part of one functum, and they can directly call into eachother.
The Quxlang coroutine interface doesn’t manage allocation of coroutine frames or coroutine handles, rather, attempting to call a coroutine invokes a so called “coroutine controller”‘s CO_CALL function. The implementation is then responsible for allocating the coroutine storage, either in objects or perhaps in a heap allocation. Each instantiated coroutine object provides a instantiated_coroutine::FRAME_TYPE which can be invoked using a controller through initialize/resume etc.
Unlike C++ coroutines, Quxlang also supports coroutine constructors and destructors. This allows e.g. database transactions to complete asynchronously using RAII wrapper types and also asynchronously rollback transactions during exception unwinding.
A type can have both a normal and coroutine destructor, in which case it will prefer the coroutine destructor from within coroutines, but use the regular one otherwise.
This also introduces so called “async-only” types, which do not have synchronous destructors and therefore cannot be used outside coroutines.
Quxlang brings familiar patterns for async programming from the Go language, specifically the GO keyword is introduced.
The precise effect of the GO keyword is determined by the coroutine controller’s CO_GO function, but the standard library provided implementation wraps the result in a future type and schedules the coroutine or function for immediate execution on the thread pool.
An example from the coroutines benchmark is reproduced below:
DOC <$ Schedules the right partition through GO and sorts the left partition in the current invocation. $>::sort_go COROUTINE(@values MUT& std::dynarr#U64, @first SZ, @last SZ, @cutoff SZ){ IF (last - first <= cutoff) { sort_serial(@values values, @first first, @last last); RETURN; } VAR pivot SZ := partition(@values values, @first first, @last last); VAR right := GO sort_go(@values values, @first pivot + 1, @last last, @cutoff cutoff); sort_go(@values values, @first first, @last pivot, @cutoff cutoff); AWAIT(right);}
In this case, the type of right above using the stdlib controller is std::future#VOID. It should also be noted that the coroutine can recursively call other coroutines implicitly, without any explicit await logic (including itself), which asynchronously blocks and awaits completion.
You may notice a few things, first, the return type is not used to provide the coroutine controller, although the std::cpp_style_coroutine_base alternative scheduler does use the return type to determine the promise type.
Second, the controller likewise implements the await operation, in this case using CO_AWAIT on std::future#VOID. The traditional C++ interface is emulated by the cpp version by having CO_AWAIT forward to the relevant functions on the awaitable.
Go language style select and channels are not yet implemented, but I would like to bring that into the language as well, as I think a GC-free language with concurrency similar to Go would make programming concurrent frameworks quite convenient.
The composite types are being replaced with parameter packs which enables flawless forwarding. Compared to C++ “perfect forwarding”, the “flawless forwarding” has the additional advantage that it can be used to forward prvalues unmodified without intermediate temporary references or move constructors. This can enable eliding move construction on compatible types.
Comparing std::thread_pool_cort_runtime with naive std::thread usage on Quicksort, with a lower bound of 2 elements, the observed performance was over 5x:
On macOS ARM64, sorting 1,024 values with 16 pool workers, the three sample medians were 4.371 ms for
std::threadand 0.860 ms forGO—about 5.1× faster for GO in this workload. The benchmark and method are in the repository.
I also have a basic vibe coded IntelliJ plugin now, although it doesn’t do much semantic analysis (just basic syntax highlighting and detecting things like arguments):

Leave a Reply