Hi everyone, I'm trying to understand execution order of assignment statement, as spec mentioned:
> The assignment proceeds in two phases. First, the operands of index expressions and pointer indirections (including implicit pointer indirections in selectors) on the left and the expressions on the right are all evaluated in the usual order. Second, the assignments are carried out in left-to-right order. I crafted a example about it: https://go.dev/play/p/6RulNQwIk4n, the core of that example is this line: phase_2, foo.bar.value = "??????", compute_value() where `foo.bar.value` causes panic due to nil pointer. The execution result shows `compute_value()` is invoked, but `phase_2` variable is not updated. Seems like the panic happened after phase 1 is complete but before phase 2 started. I assume the panic should happen in one of two phases, but not in-between. If panic happened in phase 1, `compute_value()` should not be invoked due to it happen later in same phase; If panic happened in phase 2, `phase_2` variable should have been changed already. Is the behavior working-as-indented? if so, what am I missing to understand it? Thanks for any help! Best, Kaiming -- 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 visit https://groups.google.com/d/msgid/golang-nuts/2de448bf-9408-49dd-94ef-160fbc177547n%40googlegroups.com.