2 ms·
These "GC shapes" a lot like GHC's "runtime reps": https://hackage.haskell.org/package/base-4.16.0.0/docs/GHC-Exts.html#t:RuntimeRep https://hackage.haskell.org
by Ericson2314 5y ago
These "GC shapes" a lot like GHC's "runtime reps": https://hackage.haskell.org/package/base-4.16.0.0/docs/GHC-Exts.html#t:RuntimeRep https://hackage.haskell.org/package/base-4.16.0.0/docs/GHC-E...
GHC allows recursion that is "polymorphic in the types" but "monomorphic in the runtime reps". There is no reason why Go shouldn't allow polymorphic recursion that is "monomorphic in the gc shapes" either, though they might not have bothered to allow it yet.
- lalaithion 5y agoI think they do; the problem is that Go puts way less things behind a pointer than Haskell does. Every struct is its own runtime representation. If you change the example in https://github.com/golang/go/issues/48018 https://github.com/golang/go/issues/48018 to use a pointer indirection, I think it should work.
- Ericson2314 5y agoHopefully Haskell will get some monomorphizing generics and we will make less stuff boxed too!