3 ms·
> I mean 'generics' sounds like a complex concept from the java development and I am uncertain if that's really what we need in go. That's inane and insane. Ja
by masklinn 9y ago
> I mean 'generics' sounds like a complex concept from the java development and I am uncertain if that's really what we need in go.
That's inane and insane. Java generics do almost nothing, they don't even exist at runtime in a language with (much like Go) heavy runtime semantics. Here's what Java's generics do: get typechecked, and insert implicit casts.
> Yes, I am sure there are more container formats
First, you forgot Channels and arrays (which are distinct from slices) as well as "range" to iterate over them generically, second there are more containers than that in Go's own standard library: https://golang.org/pkg/container/ https://golang.org/pkg/container/, https://github.com/golang/go/issues/18177 https://github.com/golang/go/issues/18177
> it is possible to build your own, but I think it is not easy enough
What does that mean? It is not easy enough what? To write containers? To have generics?
- JepZ 9y agoSo if generics in java don't do anything beyond 'get typechecked, and insert implicit casts.' the empty interface is enough for all use-cases in go?
- masklinn 9y ago1. the empty interface does not do the first one, and thus does not allow writing typesafe structures and code 2. and it requires significant expense of explicit casts which are not just sanity checks (which is what they are in java, due to type system weaknesses)
- deleted 9y ago[deleted]
- int_19h 9y agoYes, in a sense that structured loops don't do anything beyond inserting implicit if/goto, and so the latter is enough for all use-cases.
- JepZ 9y ago> What does that mean? It is not easy enough what? To write containers? To have generics? Actually, I meant it is not easy enough to build container formats (maybe due to the lack of generics). Btw. I will not continue this conversation as I am tired of getting insulted (inane and insane), getting downvoted for merely asking questions and you editing your post without labeling it. Just saying.
- TheDong 9y ago> I will not continue this conversation ... getting downvoted for merely asking questions You didn't ask a question. You didn't include a single question mark. What you said was a jumble of misleading and wrong words.