Generics,macros,compile time,reflections,etc

Based on poor learning background with c/c++ & D, I think C3 is a very beautiful and powerful language but it is simple and so close to C.I myself just felt a bit confustion on the subjected features & design technology concerns inside at the moment.The main confustions are they seem quite similar to each other when reading the document,but not really when writing code.

Another kinda difficulty is to understand the allocator stuffs.They are seldom been mentioned in C/C++ or D (just encountered them in Zig),so what’s the whole point (why they are totally different things in C/C++/D?) ,when should one have to use,and how to take adventage of this feature?

Any orientation would be appreciated.

Thanks and best regards,

By the way,should I ask for help here or “Discussion” in github?Which one would you prefer?

So in general you don’t need to worry about the allocators. Use mem::new / mem::new_array / malloc etc and just allocate as usual, freeing using free`.

However there is also the temp allocator, which allows you have code automatically freed. Typically you’d use the @pool macro like this:

   ... temporary allocations ...
// Temporary allocations all freed here.

Lots of standard library functions offer the return of a temporarily allocated data like this, and it’s mainly useful when a function returns some dynamic data you don’t need to retain or when you’re working on a temporary dynamic string or list.

You can look at the C3 Advent of Code 2023 solutions here: GitHub - lerno/aoc_2022_c3: Advent of Code in C3 containing some examples of this.

Finally you can often bring your own allocator, but that’s more advanced and usually nothing you need to worry about in the beginning.

Thank you.
Best regards,