Re: [go-nuts] Re: Efficient to copy Hash?

2017-11-22 Thread roger peppe
On 22 November 2017 at 18:57, 'simon place' via golang-nuts wrote: > thanks, > > this cloning is an optimisation, slowing it down a lot makes it pointless to > begin with, but luckily really, the program produced has a built-in list of > selectable, std.lib., hash

Re: [go-nuts] Re: Efficient to copy Hash?

2017-11-22 Thread 'simon place' via golang-nuts
thanks, this cloning is an optimisation, slowing it down a lot makes it pointless to begin with, but luckily really, the program produced has a built-in list of selectable, std.lib., hash routines to select from. i will add a warning for someone forking it about this. BTW your improved

Re: [go-nuts] Re: Efficient to copy Hash?

2017-11-22 Thread roger peppe
On 21 November 2017 at 21:56, 'simon place' via golang-nuts wrote: > i found this code, and use it on hash.Hash > > // copy an interface value using reflect (here for pointers to interfaces) > func clone(i interface{}) interface{} { > indirect :=

[go-nuts] Re: Efficient to copy Hash?

2017-11-21 Thread 'simon place' via golang-nuts
i found this code, and use it on hash.Hash // copy an interface value using reflect (here for pointers to interfaces) func clone(i interface{}) interface{} { indirect := reflect.Indirect(reflect.ValueOf(i)) newIndirect := reflect.New(indirect.Type())