What I found out was that even though there are frustrating moments when inheritance IS actually the optimal solution, being forced to use composition has helped me think differently about how to structure my code for the better. Inheritance makes it too easy to design yourself into a trap where refactoring becomes extremely expensive even when necessary. Go is designed to make refactoring much easier by doing things like forcing the use of composition.


#golang #programming

բնօրինակ սփիւռքում(եւ մեկնաբանութիւննե՞ր)

Generics may well be added at some point. We don’t feel an urgency for them, although we understand some programmers do.

Generics are convenient but they come at a cost in complexity in the type system and run-time. We haven’t yet found a design that gives value proportionate to the complexity, although we continue to think about it. Meanwhile, Go’s built-in maps and slices, plus the ability to use the empty interface to construct containers (with explicit unboxing) mean in many cases it is possible to write code that does what generics would enable, if less smoothly.


#golang #go #generics #programming

բնօրինակ սփիւռքում(եւ մեկնաբանութիւննե՞ր)