On Mon, Mar 8, 2021 at 11:06 PM Ian Lance Taylor <i...@golang.org> wrote:
> On Wed, Mar 3, 2021 at 7:02 PM Sokolov Yura <funny.fal...@gmail.com> > wrote: > Thanks. I filed https://golang.org/issue/44870 for this. > Cool, well done. I shall share that with some potentially interested engineers. > > > 2. When I need to iterate map. > > Using standard reflect package there is no way to iterate map[string]int > without allocation of string header and int for every key-value pair. When > > key or values is struct, things become worse. > > That is how the language works also. Map keys and values are not > addressable. Keeping an address for them is very deeply unsafe, and > could break irretrievably with future changes to the garbage > collector. Or, to put it another way, supporting this functionality > imposes limitations on the garbage collector that I don't think we > want to impose. I'm not sure what we can do here. Go's map type > intentionally does not give programs complete control over memory. > Hm, would take some time to review the vision. > > It's possible that generics will address some of these use cases. > Ackdowledged. Yan > > Ian > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWzLyD0gn9r25M6HTGoXgUJEwXz-y2qVX4C4%3DGXp8mouQ%40mail.gmail.com > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CANFCsz8BBiotCqOwyvU-n%3DpyYwsW-wR6FZyV0AUX9giHNd36Xw%40mail.gmail.com.