On Mon, Feb 18, 2019 at 3:10 AM Louki Sumirniy <
louki.sumirniy.stal...@gmail.com> wrote:

> I know what it is. The closure is implicitly receiving the variable by
value, so its state when the goroutine spawns is fixed into its local scope.

Closures are implemented in Go using pointers to the captured variables.

> Incidentally, the issue of stale pass-by-value and even can be stale
pointers

Modulo using package unsafe, Go is a memory safe language. No stale
pointers.

> Another thought occurs also, since I am quite confused still about the
value vs reference mechanism behind array variable parameter passing, since
theoretically that code should not have this issue as it should be getting
passed around as a pointer transparently.

It's not clear to me what do you mean, but wrt passing arguments to a
function in Go, everything is passed by value, so no, Go does not pass
arrays as pointers.
-- 

-j

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to