Hacker News new | past | comments | ask | show | jobs | submit login

This is exactly what I feel when using Go. Love the way I can really focus on solving real problem rather than trivial (but important things like styling and formatting). About generic, when I thought need it, I always able to find simpler design using composition.



>About generic, when I thought need it, I always able to find simpler design using composition.

How exactly would composition help you e.g. make a general purpose reusable math library for different kinds of numeric types?


I think the implicit argument is that “a general purpose reusable math library for different kinds of numeric types” is not a real problem.

A real problem is, “I need to draw this triangle”, and using math.Cos w/ float64s works just fine.


And yet it's a problem anybody who makes any kind of library that should work with > 1 types, faces...

Not just math and scientific libraries. Even a simple reusable data structure. And fact it's so commonly needed for this, that Go's slices and maps would have been useless unless Go's designers have not cheated and used genericity for themselves...

And let's not get into reusable abstractions for behavior -- like a library that encapsulates the 5-10 more common uses for channels and goroutines (span N goroutines and wait for all to collect the results, span N and use first result, and so on).


You could say my usecase is on different scope than that. But I still on the against side of the generic. It will add (for me unnecessary) complexity to the language.

Cmiiw even when have generic in place, we still need to write the code for each type right? Just the interface is the same. (this argument sounds silly actually, just want to say that)


About generic, when I thought need it, I always able to find simpler design using composition.

This doesn't seem like it can be broadly true, though. Have you never needed containers besides Map and Array?


You're right it couldn't be true on all the cases In my use case map and array are generally enough.




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

Search: