by Leonard Ritter, May 3rd 2024
As part of bootstrapping the next iteration of the Scopes compiler, which, until now, oriented itself heavily along LLVM and C semantics, the author tackled the general issue of operating on memory, specifically solving longstanding usability issues that C programmers should be intimately familiar with, which increase cognitive load and make programming in C a never-ending nightmare. These issues are:
- There are at least three kinds of pointers which all use the same type but need to be treated differently: global, stack and heap.
- Rules of memory ownership and sharing are all informally specified, and difficult to enforce in a heterogeneous environment.
- Stack allocations may lead to stack overflow.