import sync struct St{ mut: n int } fn f(ch chan &St, mut sem sync.Semaphore) { w := St{} ch <- w mut x := St{} ch <- x // the following works y := &St{} ch <- y mut z := &St{} ch <- z sem.wait() println(z) } fn main() { c := chan &St{} mut sem := sync.new_semaphore() go f(c, mut sem) y := <-c // this should fail mut z := <-c z.n = 9 sem.post() println(y) println(z) }