On Wed, Jul 15, 2020 at 7:59 AM kaleidawave <kaleidaw...@gmail.com> wrote: > > Correct me if I am wrong but wouldn't square bracket syntax have an ambiguity > around calling a function pointer at a position in a slice: > > z := []func() int{x, y}; > a := z[0]();
A parsing ambiguity arises when the same code can be parsed in different ways. This case isn't an ambiguity, because it is always parsed as "z[0]" followed by "()". It's true that until type checking we don't know whether "z[0]" is an index expression or a function instantiation. But that is OK. We have similar issues in the language today for "f(x)", which could be either a function call or a type conversion. Ian -- 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/CAOyqgcU0T68ccL1gjSEhTaAvZUotH7sVkzeiS48HQOXisOr46g%40mail.gmail.com.