[go-nuts] map[X]Y or map[X]*Y ?

2017-05-12 Thread aktungmak
Setting aside the receiver types of methods for the moment, if we consider the following declaration: type Y struct { //some fields } Which of the following would be "better" (from a speed and storage usage viewpoint)? map[X]Y map[X]*Y If we consider that this map could be handed between

[go-nuts] How to accept any function with one return value as a parameter

2017-03-19 Thread aktungmak
Hi, I am trying to write a function that initializes a generic collection. For adding new items to the collection, the user specifies a constructor which takes one argument and returns a pointer to the struct that will be inserted in the collection, and also sets fields to initial values. For