News for hackers. Stuff that matters.
Re:I can't keep up with idiomatic Rust by correct_horse on Wednesday April 08, 2020 @10:51PM (#22819352)
As a side note, Java also didn't ship with generics. Java was released in the mid 90s and didn't have generics until about 10 years later with version 5. This timing should feel familiar - Go first appeared ~10 years ago in 2009.

You may remember that in Java 1.4, `get`ting from collections (e.g. ArrayList) always returned Object, which you were expected to cast to their runtime type (or a class that their runtime type inherits from). I was young at the time, correct me if I'm wrong. Contrast this with Go's solution, which seems to be user-inaccessible compiler magic. I much prefer Go's solution to Java's, but I also like generics.

Re:I can't keep up with idiomatic Rust by saagarjha on Wednesday April 08, 2020 @10:53PM (#22819361)
I really hate user-inaccessible compiler magic. Java had its fair share of that, but Go seems to take it even further :(
Re:I can't keep up with idiomatic Rust by Skunkleton on Thursday April 09, 2020 @03:44PM (#22826407)
I think compiler magic is pretty great. Hotspot is a pretty magical compiler. Go is less magical IMO because it is AOT compiled.
Re:I can't keep up with idiomatic Rust by saagarjha on Thursday April 09, 2020 @04:14PM (#22826717)
By compiler magic I really mean syntax reserved to the language itself; for example, Java's String having extra operator superpowers or Go's generics that are only available to a chosen set of standard collections.
Re:I can't keep up with idiomatic Rust by antoinealb on Thursday April 09, 2020 @05:19AM (#22820956)
I think you can do the same in Go, using the empty interface (that can represent any type) and then having the user cast it to the correct type. Unfortunately this is not type safe, and type safe generics in go, such as maps is only available to the compiler.