Design Goals & Background
Design goals
- Procedural language, with a pragmatic ethos to get work done.
- Minimalistic, no feature should be unnecessary or redundant.
- Stay close to C - only change where there is a significant need.
- Learning C3 should be easy for a C programmer.
- Seamless C integration.
- Ergonomic common patterns.
- Data is inert.
- Zero Is Initialization (ZII).*
- Avoid “big ideas”.
* “Zero Is Initialization” is an idiom where types and code are written so that the zero value is a meaningful, initialized state.
Features
- Full C ABI compatibility
- Module system
- Generic modules
- Design by contract
- Zero overhead errors
- Semantic macro system
- First-class SIMD vector types
- Struct subtyping
- Safe array access using slices
- Safe array iteration using foreach
- Easy to use inline assembly
- Cross-platform standard library which includes dynamic containers and strings
- LLVM backend
C3 Background
C3 is an evolution of C, a minimalistic language designed for systems programming, enabling the same paradigms and retaining the same syntax as far as possible.
C3 started as an experimental fork of the C2 language by Bas van den Berg. It has evolved significantly, not just in syntax but also in regard to error handling, macros, generics and strings.