What I’m suggesting is that imagine a dev changes that code and has version() 
access the request property…

This is why if you are sharing data in a concurrent way you need to be very 
careful of all usages. 

The safest solution is to use immutable objects - of which the non pointer are. 

So saying - just use pointer receivers - woefully underestimates the work to do 
shared concurrent code correctly. 

> On Nov 15, 2023, at 10:33 AM, Marvin Renich <m...@renich.org> wrote:
> 
> * Robert Engels <reng...@ix.netcom.com> [231114 21:55]:
>>   Switching to pointer receivers everywhere actually makes this worse. Any
>>   access is potentially a data race. 
>>   It stills seems like this is a compiler issue. There needs to be a way to
>>   synchronize the pointer to value copy in conjunction with other
>>   synchronization. 
>>   The only way to do this would be to write your own pointer to value
>>   conversion methods that have synchronization. 
> 
> I don't understand what you are saying.  Are you saying that if you take
> the code from Dave Cheney's article, and change the receiver for the
> version method from value to pointer:
> 
>  func (*RPC) version() int {
> 
> that there is still a race in his code?  Or are you saying that with
> that change you could add code where the act of calling a method is
> inherently a race?  If the latter, can you give an example?
> 
> ...Marvin
> 
> --
> 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/ZVTyykWUgiwPLH9n%40basil.wdw.

-- 
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/A1302C26-7DED-483C-A250-FB84D92E0661%40ix.netcom.com.

Reply via email to