Re: [go-nuts] [generics] Awkwardness interfacing between primitives and structs

2020-06-17 Thread Robert Engels
This is not how it is typically done in Java. You create an immutable List that is backed by the array. No copy required. You will also implement RandonAccess to distinguish from linked lists. Lastly, it doesn’t need to be immutable, and lots of structures like ArrayList are mutable and backe

[go-nuts] [generics] Awkwardness interfacing between primitives and structs

2020-06-17 Thread Hunter Herman
Suppose I want to write a function over any list like container (histogram, reverse...) how can I? Java requires special code if you want to process arrays — thus most code takes Lists, and accepting an array (eg a vararg) is likely to lead to a copy into a list at some point. Is go fated to inh