News for hackers. Stuff that matters.
Re:Topo – A library to create in-process topologies of gorou... by Animats on Saturday November 15, 2014 @01:08PM (#8612212)
Right. Everything gets converted to Go's "any" type, "Interface{}". At the output end you have to use a type assertion to get it back into the actual type. Note that an "Interface{}" is a pointer; you're not queuing the data, you're queuing a pointer to the data. So you're sharing data between goroutines. The sender must allocate a new variable for each send.

(This is my biggest complaint about Go. It's too easy to accidentally share data between goroutines, because so many things are implicitly references to mutable objects. Slices, for example, are references. Erlang and Rust, which also use queues heavily, avoid doing this.)

There are no comments on this comment yet.