News for hackers. Stuff that matters.
Re:From Java to Go, and Back Again (2016) by piano on Saturday June 23, 2018 @05:17PM (#17383499)
> "You can't do X because Go doesn't have Y" was the original point. My response was "you do X with Z." Whether or not Z is good or bad is completely orthogonal to the original point seeing as how it's idiomatic in Go.

No, it's not orthogonal. The part you cited even mentions strong typing, thereby IMO it is pretty obvious type-safety is a requirement here. Otherwise what would even be the point of the exercise? Mapping of some data to some other data? You can do that in _any_ turing-complete language.

The comment said "you can’t write a generic map from an array of T to an array of R" and, indeed, you can't do that in Go. Your code maps a slice of dynamic values to a slice of dynamic values. It doesn't map array of T to array of R, as requested, because there's simply no way to express that in Go.

Besides, I think think it even actually _is_ idiomatic since you used reflection.

Re:From Java to Go, and Back Again (2016) by daenz on Sunday June 24, 2018 @02:50AM (#17385334)
>Besides, I think think it even actually _is_ idiomatic since you used reflection.

https://appliedgo.net/generics/

See point 4 and 5. It is idiomatic.

Re:From Java to Go, and Back Again (2016) by piano on Sunday June 24, 2018 @03:00PM (#17387839)
Are you joking / trolling? The article clearly instructs to _avoid_ refleciton...
Re:From Java to Go, and Back Again (2016) by daenz on Monday June 25, 2018 @10:10AM (#17392536)
That's the author's personal opinion, but it doesn't make it any less idiomatic. There's a difference. And point 4 isn't reflection at all, it's type assertions.