Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Looking at it, I wouldn't want to use it either. It seems to add a lot of overhead. In the first 15 lines of the function it's mostly implementing type checking at runtime using reflection. Every single time this is used it would redo that type checking. In most statically typed functional languages that would just be done once at compile time and the implementation would be the equivalent of the last 7 lines or so.

I imagine with generics it could be greatly simplified, but I don't know Go well enough to venture how it would be done. Though if it weren't faster than that version I'd be shocked.

For clarity, I was looking at reduce.go, all the others seem to do similar tricks with reflection that would also add overhead that generics should eliminate.



Right, using generics all of the reflection should be unnecessary and the implementation should be much simpler and more performant.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: