Re:Go generics may use square brackets [] not parenthesis ()
by throw_m239339 on Wednesday July 15, 2020 @06:56AM
(#23843524)
The problem is not so much the absence of generics but the availability of crazy reflection at runtime compared to the rigid type system at compile time. There absolutely is a lack of balance here.
All these things were already pointed out 10 years ago and were met by "you don't need that with Go", "Go back writing Java" sort of contempt, which gave the Go community a bad reputation.
Go could have been fixed 10 years ago if Rob Pike and co listened. They didn't want to because they thought they knew better than everybody else. ADA already fixed the genericity problem while keeping things readable with a limited form of generics as incomplete types.
Re:Go generics may use square brackets [] not parenthesis ()
by pjmlp on Wednesday July 15, 2020 @07:15AM
(#23843641)
As I already mentioned a coupled of times, even CLU like generics would have been a good enough solution.
Something that they acknowledged not bothered to look at initially.
https://go.googlesource.com/proposal/+/master/design/go2draf...
> We would have been well-served to spend more time with CLU and C++ concepts earlier.
Re:Go generics may use square brackets [] not parenthesis ()
by BenFrantzDale on Wednesday July 15, 2020 @06:20AM
(#23843288)
Well said. As a C++ programmer I always find Go rubs me the wrong way. Like they want to make my life difficult. I think you hit the nail on the head that it feels condescending. My visceral reaction to not being able to write a standard library as performant as the provided one is “this is a toy language”. I know it’s not and I know I have to use C to do that in Python, but still.
There is a difference between becoming C++ and allowing programmers to make fundamental abstractions without interface{} hacks.