SuperC documentation

⚠️ This is a PROPOSAL DRAFT. Defer is semi-implemented
Development is not going to advance until LLVM backend is minimally stable.

Possible cancellation points for defer statements

This is still up to debate, we have covered goto, but we have not talked about longjmp, _Noreturn functions or signals.

The current idea (and this can be changed) is that the user may or may not want to run defers at some cancellation points, because maybe the user wants to fast-fail, among other reasons.

Also, some cancellation points are “easy” to catch, but some are impossible, like signals.

Nowadays, there are two ideas to leverage, that can coexists:

Since both ideas are non-exclusive, we may implement assign defer statement, and make __builtin_unwind_defers() to just write the closure calls in order.

Edge case code generation

Optimizations

Some possible optimizations to this approach are:


Previous

(DRAFT) Lambda Expressions & Closures