4 ms·
> However, one problem with it is that a polymorphic type, such as [] of kind "* -> ", or a function like map of type "forall a b. (a -> b) -> [a] -> [b]" reall
by Athas 8y ago
> However, one problem with it is that a polymorphic type, such as [] of kind "* -> ", or a function like map of type "forall a b. (a -> b) -> [a] -> [b]" really only works with boxed types.
Can you explain why this is, or provide a reference to literature where it was investigated? I still (even after getting a PhD in compiling functional languages!) do not understand why you could not create code parameterised over the sizes of the arguments. For example, a 'cons' cell could be represented as first the size of the 'car' in bytes, then the 'car' value inline/unboxed, then a pointer to the 'cdr' cell. The Sixten language[0] does this, although it's still very early in its development. I'm not saying this is necessarily a good solution, I just wonder why I have never seen it seriously considered (and perhaps rejected).
In practice, I do believe that monomorphisation is very often a good strategy.
[0]: https://github.com/ollef/sixten https://github.com/ollef/sixten
- gpderetta 8y ago> why you could not create code parameterised over the sizes of the arguments If I understand correctly, that's what BitC was trying to do, but the extreme complexity of the compilation model was cited as one of the reasons the project failed. The postmortem is here I think, but I can't access it right now: http://www.coyotos.org/pipermail/bitc-dev/2012-March/003300.html http://www.coyotos.org/pipermail/bitc-dev/2012-March/003300....