News for hackers. Stuff that matters.
Re:Things that make Go fast by vanderZwan on Saturday June 07, 2014 @05:51AM (#7861735)
> Can you write, say, a heap or a read-black tree that can store wither ints and strings, that will embed the ints?

I'm not sure I understand this sentence. Do you mean a union type? Or a generic datastructure? We all know Go doesn't have generics - that topic has been beaten to death, so let's not derail the discussion and just say this can be a valid reason for Go not fitting your use-case. But just for comparison, here's an implementation of a "generic" LLRB Tree in Go using interfaces and runtime reflection:

https://github.com/petar/GoLLRB

I suppose you could hand-write it to fit the value type of choice? Does that answer your question?

Re:Things that make Go fast by seanmcdirmid on Saturday June 07, 2014 @10:56AM (#7862231)
> We all know Go doesn't have generics - that topic has been beaten to death, so let's not derail the discussion and just say this can be a valid reason for Go not fitting your use-case.

Parents point was that Go will still box primitives in a generic collection class...just like Java does. So this isn't a special advantage of Go at all (it has nothing to do with Go not having type parameters). The only languages that don't box in generic collections is C++ and perhaps C# (it doesn't have to because of its template-like type parameter semantics, but still might to reduce code duplication).

Re:Things that make Go fast by pron on Saturday June 07, 2014 @12:01PM (#7862350)
Right. Although the template method has its own issues. For example, once the element type size exceeds 64 bits, you can no longer assume an atomic write/read. This isn't a big problem considering that concurrent data structures don't usually rely on the write/read atomicity of the elements themselves (though they do rely on atomicity of modifying internal, structural data), but that's just something to think about.
Re:Things that make Go fast by dbaupp on Saturday June 07, 2014 @11:54AM (#7862337)
Rust doesn't, and (I think) D doesn't.
Re:Things that make Go fast by seanmcdirmid on Saturday June 07, 2014 @12:26PM (#7862395)
Right. I should have qualified my statement with languages that I'm aware of.