☯️ Zen of C-lang ☯️
1: Use the monad
2: A Makefile is ugly, but small
3: You don't need libraries
4: Static variable is your encapsulation
5: Arena allocator is boss
6: Return struct wrapped in a Result monad
7: Enjoy C's lightness
#C, #C-lang, #monad, #zen
1: Use the monad
2: A Makefile is ugly, but small
3: You don't need libraries
4: Static variable is your encapsulation
5: Arena allocator is boss
6: Return struct wrapped in a Result monad
7: Enjoy C's lightness
#C, #C-lang, #monad, #zen
Comments
I was staring at my simulation program with RayLib GUI in 7k lines of relatively clean C code. And though hmm ...
Now I don't know why I thought C was barbaric, but I will probably wake up with a gray beard tomorrow.
#define RESULT_MONAD(T) \
typedef struct { \
T res; \
const char *error; \
} T##Result
#define CREATE_RESULT_MONAD(T) (type##RESULT) {}