| ▲ | matheusmoreira 5 hours ago | |||||||||||||
> In the absence of proper language support, “sum types” are just structs with discipline. With enough compiler support they could be more than that. For example, I submitted a tagged union analysis feature request to gcc and clang, and someone generalized it into a guard builtin. https://github.com/llvm/llvm-project/issues/74205 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112840 GCC proved to be too complex for me to hack this in though. To this day I'm hoping someone better than me will implement it. | ||||||||||||||
| ▲ | nine_k 5 hours ago | parent [-] | |||||||||||||
With proper discipline, one can even program a Turing machine directly. The problems are two: (1) Doing so is very slow and arduous, and (2) a chance of making a dangerous error is still quite high. For instance, it appears that no amount of proper discipline, even in the best developers, allows to replace proper array support with a naked pointer to a memory area. | ||||||||||||||
| ||||||||||||||