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.
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