Re: [go-nuts] Evaluation order of return

2020-09-25 Thread Michael Jones
Another way to understand the general topic is by comparison to Lindenmayer systems. The compiler is an iterated rewrite framework and the exact code that you get can be a surprise the same way L-System graphics vary. On Thu, Sep 24, 2020 at 10:36 PM cs.ali...@gmail.com < cs.alikoyu...@gmail.com>

Re: [go-nuts] Evaluation order of return

2020-09-24 Thread cs.ali...@gmail.com
I understood perfectly now, thanks for the explanations and the link! I really appreciate you guys! On Thursday, September 24, 2020 at 3:28:10 AM UTC+3 Ian Lance Taylor wrote: > On Wed, Sep 23, 2020 at 1:10 AM cs.ali...@gmail.com > wrote: > > > > I am not actually questioning the current

Re: [go-nuts] Evaluation order of return

2020-09-23 Thread Ian Lance Taylor
On Wed, Sep 23, 2020 at 1:10 AM cs.ali...@gmail.com wrote: > > I am not actually questioning the current design, as you both said it is not > a good practice to call a return statement as I wrote above, I am trying to > understand the relation between memory, interface and order of evaluation.

Re: [go-nuts] Evaluation order of return

2020-09-23 Thread Jesper Louis Andersen
On Wed, Sep 23, 2020 at 10:09 AM cs.ali...@gmail.com < cs.alikoyu...@gmail.com> wrote: > Is there a paper that I can find why the compiler considers them for > ordering, why it is important for performance or anything else? > > A CPU has a limit to how many load/store instructions it can issue in

Re: [go-nuts] Evaluation order of return

2020-09-23 Thread cs.ali...@gmail.com
Thanks Axel, Ian! I am not actually questioning the current design, as you both said it is not a good practice to call a return statement as I wrote above, I am trying to understand the relation between memory, interface and order of evaluation. It is clear that the compiler takes account of

Re: [go-nuts] Evaluation order of return

2020-09-21 Thread Ian Lance Taylor
On Mon, Sep 21, 2020 at 9:34 AM 'Axel Wagner' via golang-nuts wrote: > > The evaluation order is defined here: > https://golang.org/ref/spec#Order_of_evaluation > The important part is that the order of evaluation in a return statement is > only defined for function calls, method calls and

Re: [go-nuts] Evaluation order of return

2020-09-21 Thread 'Axel Wagner' via golang-nuts
The evaluation order is defined here: https://golang.org/ref/spec#Order_of_evaluation The important part is that the order of evaluation in a return statement is only defined for function calls, method calls and communication statements, but not in relation to other operations. So, in return