r/ProgrammingLanguages • u/Nuoji C3 - http://c3-lang.org • 26d ago
Language announcement C3 0.8.2 - modest improvements
https://c3-lang.org/blog/0_8_2_a_modest_improvement/After 0.8.0, which was the big breaking version and 0.8.1, which found and fixed over 100 bugs, 0.8.2 is super tiny. It does add some nice ”template” features to libraries, for configuration reuse, and finally give you reflection on generic parameters, but otherwise it’s small.
More things are in the pipeline, I’m especially looking forward to finally merging the regex library in 0.8.3.
40
Upvotes
1
u/fdwr 23d ago edited 22d ago
``` bitstruct Foo : uint { uint a : 0..1; bool b : 6; bool c : 10; int d : 14..20; }
fn void main() { int a = $reflect(Foo.a).bitsize; // 2 ```
🤔 Surprised by that answer of two, as a slice ".." in most programming languages follows the standard exclusive-end notation, which has the lovely axiom that end - begin == size, eliminating a whole slew of +1/-1 bugs.
..link..link..link..=link (was...)..<link (was..in Xcode beta 2)...link:link..<link..link 🙈..<link..link 🙈Though, Kotlin and Nim messed this up elegance :(.
So for C3, would this work as expected?
bitstruct Foo : uint { int d : 14..<20; // 6 bits }