I really appreciated this. I love it when somebody can explain a thorny topic slowly, in pieces, starting at the basics, then work their way to the real “pea under the mattress” of the problem. This makes me want to try Go. The language’s behavior seems straightforward after reading this.
I really appreciated this. I love it when somebody can explain a thorny topic slowly, in pieces, starting at the basics, then work their way to the real “pea under the mattress” of the problem. This makes me want to try Go. The language’s behavior seems straightforward after reading this.
Just yesterday, there was debate about whether Go should use reference semantics for some assignments (in loops): https://lobste.rs/s/xjgr0o/fixing_other_go_loop_bug#c_vtnbxt
For what it’s worth, if one of the iterator proposals goes through, you can get it for free by writing a reference iterator.
for p := range iter.ByRef(valArray) { p.foo = … }
The iterator proposal has a pretty far ranging impact on what would be considered idiomatic in the language. It’s very cool but also a little scary.