3 ms·
Nice reference but with some strange bits: > Algebraic data types are usually represented using a heap. Because of their non-uniformity, algebraic data types a
by Hirrolot 4y ago
Nice reference but with some strange bits:
> Algebraic data types are usually represented using a heap. Because of their non-uniformity, algebraic data types are more difficult to scan.
Using a heap??? We can represent ADTs using stack as well, that's what we usually do in C and Rust.
Shameless plug: https://github.com/Hirrolot/datatype99 https://github.com/Hirrolot/datatype99 (a library of mine that generates type-safe ADTs for pure C99).
- whizzter 4y agoThis post seems related to the authors of MPS (1) that seems to be a general garbage-collector to use with various languages. Many GC'd languages really didn't bother with stack-allocating variable-size entities, and regardless of if they did then _precicely_ scanning the stack would be complicated without compiler help. If the compiler doesn't leave any info to the GC, then it can't know if it's scanning a pointer or a float and if your GC strategy relies on compacting memory (ie moving objects) then trying to guess between a float or a pointer can become fatal. (1) https://github.com/Ravenbrook/mps https://github.com/Ravenbrook/mps