scgolang / osc

Open Sound Control 1.0 for golang
http://godoc.org/github.com/scgolang/osc
MIT License
35 stars 9 forks source link

Use of pointers #11

Open avlapp opened 2 years ago

avlapp commented 2 years ago

func (msg Message) Bytes() []byte) https://pkg.go.dev/github.com/scgolang/osc#Message.Bytes

As example.

I see other packages using a pointer there: func (msg *Message) Bytes() []byte)

tleb commented 2 years ago

Why would the use of pointer receivers be a good thing when the method doesn't modify the struct?

avlapp commented 2 years ago

I'm fairly new to Go and pointers. I found this: https://youtu.be/29LLRKIL_TI?t=888 So I think your point is valid and on top of that, pointers are not concurrency safe.