Memory model.
The project looks very interesting.
I was wondering whether it would be a good fit for my hobby purely functional language. But I could not find much information about the MIR memory model in readme.
- Do I have to manage memory manually, or is there a GC?
- Can I do anything with pointers, I could do in C?
- Are there structures (C struct) and unions (or ADTs)?
It is an interesting question. I was asked a few times about this.
One goal of the project is to be simple. Adding GC support would complicate the project. There is no even distinctive pointer type in MIR (it is basically 32- or 64-bit integer).
So to implement GC, you should generate MIR code by yourself to process pointers for GC or to use a conservative GC by scanning the stack and every integer value on the stack in a range of heap addresses to consider a pointer.
I think it is possible to create one additional layer on the top of MIR to deal with pointers for GC but I have no plans to do it by myself as CRuby/MRuby uses conservative GC and I don't need to deal with pointers.
If you don't like conservative GC and would like to use C for code generation, GC implementation would be more difficult as keeping track of pointers will need C extensions for c2m. I am thinking about some extensions for C to implement speculative code generation. I probably will think about implementation C extensions for GC but neither I can promise implementation of it nor moreover I can say when it will be done.
I hope this answers your questions about GC.