Hacker News new | ask | show | jobs
by chrnad 2848 days ago
I think it's hard to get a feel for how it would look in practice from those short examples.

Library code might be a little ugly and abstract, but as an end-developer, you usually don't need to worry about it. The code you yourself would see and write is going to have a lot more meaning and be more understandable.

I've rarely had to do anything fancy with generics in my own projects. Where I've seen it be most useful is when I want to offer a flexible public API -- in which case, the choice of writing a bit of generic library code is much less smelly than copy pasta.

1 comments

> Library code might be a little ugly and abstract, but as an end-developer, you usually don't need to worry about it.

But the functions you provide for the code you're writing are a library for someone else.