Title: Structs and Testing Advancements in Cx
Structs finally landed on submain. But it’s not just about introducing struct syntax; we wrapped up Phase 1 and Phase 2 in a single commit (dad4220). The upgrade includes struct declarations, field access, impl blocks with methods, and notably, compound assignment through dot-access. This means you've now got += and friends working through dot-access, allowing assignments directly on struct fields. Sure, we could have split it and tackled dot-access later, but tight integration was the priority here — getting the struct feature set complete in one go.
Deep Dive into Structural Changes
When breaking down this deployment, the core pipeline feels the impact: Abstract Syntax Tree (AST), lexer, parser, semantic analysis, type system, Intermediate Representation (IR) lowering, and runtime all tweaked. This wasn’t just a slapdash feature add; it involved a deep incision into the language's mechanics. This overhaul gives developers more expressive and direct coding practices for complex data models, offering a closer alignment with real-world app design practices.
The real technical hook here wasn't just field access — it was trading the initial sprint on separate features for a fully formed package, ensuring smoother developer experiences later on.
Matrix Testing: New Approach
Together with structs, we also landed a nifty batch of updates on submain (7e747c4). Operator improvements and exit code handling came along, but the star here is the new verification matrix test runner. Found in src/tests/run_matrix.sh, this addition introduces an expected-fail test framework. Tests get categorized with a .expected_fail suffix, making it a breeze to identify tests that should fail under current logic constraints. It handles a gamut of scenarios: incorrect return type, void return errors, argument mismatches, and more.
Why a shell script and not merge into Cargo? Separation for simplicity’s sake — it allows a focused testing environment without binding to the existing test harness too tightly.
Toward a Better Backend: What's Brewing
On another front, there’s active work on backend IR. The branch codex/backend-ir-from-main is alive with changes to ir/lower.rs, ir/mod.rs, and ir/validate.rs. While no commits hit yet, this signals upcoming shifts towards a comprehensive backend pipeline. It’s laying the groundwork for what comes next in Cx’s evolution.
Concluding Thoughts
Latest merges and updates keep pushing the development rhythm to a stable cadence. We cleaned up after prior reverts and rewrites, ironing out the kinks. The struct implementation edges closer to main, backed by the ongoing backend IR effort. Feels like the moment before a sprint, with more phases to unfold.
Stay tuned as we push the backend IR work and ensure struct work seamlessly joins the main branch, setting the stage for what's next.
Follow the Cx language project:
- Website: cx-lang.com
- GitHub: github.com/COMMENTERTHE9/Cx_lang
- Dev.to: dev.to/commenterthe9
- Bluesky: thecomment.bsky.social
- Twitter/X: @commenterthe9
Originally published at https://cx-lang.com/blog/2026-03-15
Top comments (0)