goderive icon indicating copy to clipboard operation
goderive copied to clipboard

reuse fmap's input list, if output type is the same as the input type

Open awalterschulze opened this issue 8 years ago • 4 comments

awalterschulze avatar Jul 12 '17 11:07 awalterschulze

This is a performance improvement.

awalterschulze avatar Jul 12 '17 11:07 awalterschulze

I'm not sure that this is necessarily a good thing - there are arguments both ways. It's not always OK to modify the slice that's being passed in. I suspect that it might be better for there to be a different plugin that modifies in place.

rogpeppe avatar Aug 25 '17 10:08 rogpeppe

This is why I would love to have immutability in Go, so that we don't have to make this decision, but now here we are.

awalterschulze avatar Aug 25 '17 10:08 awalterschulze

So you would prefer to rather have an inplace variant of fmap and filter than it being the default?

awalterschulze avatar Aug 26 '17 17:08 awalterschulze