Just adding a quick note: It turns out this topic has been discussed 
before. I thought I tried to search but perhaps I had been using the wrong 
keyword. If you search for "pure" or "purity" you will see a lot of stuff. 
I am hoping to review it all soon and see if I can come to any conclusions 
based on the previous discussion. Thanks.

On Monday, March 27, 2023 at 11:05:16 AM UTC-3 nc wrote:

> Hello,
>
> I have found that I have a tendency to try to code non-method funcs in a 
> pure way (functionally speaking - so that the caller will not modify any of 
> its params). I know it is  possible to pass a pointer (or slice or map - is 
> that all of them?) as a function param and then modify it in the called 
> func like is done in https://gobyexample.com/pointers in the zeroptr 
> func, but I have a strong preference to try to do this as rarely as 
> possible and to never modify func params if I can get away with it. However 
> I see some Go code written by others that defintely doesn't agree with this 
> idea and I wonder if perhaps I am misguided. Perhaps it would make sense in 
> another language but doesn't have a place in Go. I am not really sure.
>
> I just wanted to know if anybody had any well-formed opinions on this 
> based on tested experience with Go. Thanks for your help.
>
> - nc

-- 
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/8f536043-3b73-45ab-aacb-32c3e88ecd43n%40googlegroups.com.

Reply via email to