Re: [go-nuts] Re: About argument evaluation order.

2018-03-20 Thread T L
On Tuesday, March 20, 2018 at 1:47:43 PM UTC-4, Ian Lance Taylor wrote: > > On Tue, Mar 20, 2018 at 8:52 AM, T L > > wrote: > > BTW, another problem: > > are the function calls appearing in a composite literal evaluated by > their > > lexical left-to-right order? > > Assuming you mean somet

Re: [go-nuts] Re: About argument evaluation order.

2018-03-20 Thread Jan Mercl
On Tue, Mar 20, 2018 at 6:48 PM Ian Lance Taylor wrote: > In this case I don't agree. The order of evaluation rules make it > clear that the first output is 1 and the last output is 2, but they do > not specify when the value of y is read. I see, I missed the "... and the evaluation of y is not

Re: [go-nuts] Re: About argument evaluation order.

2018-03-20 Thread Ian Lance Taylor
On Tue, Mar 20, 2018 at 10:30 AM, Jan Mercl <0xj...@gmail.com> wrote: > On Tue, Mar 20, 2018 at 6:19 PM T L wrote: > >> Yes "1 1 2" is the output of gc, but I can't find any guarantees made for >> this output in Go specification. > > The guarantee was mentioned: LTR evaluation order as seen in the

Re: [go-nuts] Re: About argument evaluation order.

2018-03-20 Thread Ian Lance Taylor
On Tue, Mar 20, 2018 at 8:52 AM, T L wrote: > BTW, another problem: > are the function calls appearing in a composite literal evaluated by their > lexical left-to-right order? Assuming you mean something like []int{f(), g(), h()}, then, yes. The order of function calls must be f(), g(), h(). Ia

Re: [go-nuts] Re: About argument evaluation order.

2018-03-20 Thread Jan Mercl
On Tue, Mar 20, 2018 at 6:19 PM T L wrote: > Yes "1 1 2" is the output of gc, but I can't find any guarantees made for this output in Go specification. The guarantee was mentioned: LTR evaluation order as seen in the specs here: https://golang.org/ref/spec#Order_of_evaluation -- -j -- You r

Re: [go-nuts] Re: About argument evaluation order.

2018-03-20 Thread T L
On Tuesday, March 20, 2018 at 12:38:25 PM UTC-4, Jan Mercl wrote: > > On Tue, Mar 20, 2018 at 5:18 PM T L > > wrote: > > > For the following example, the output may be any of "1 7 2", "1 8 2" and > "1 9 2"? > > The output is "1 1 2" due to LTR evaluation order mandated by the specs: > https://

Re: [go-nuts] Re: About argument evaluation order.

2018-03-20 Thread Jan Mercl
On Tue, Mar 20, 2018 at 5:18 PM T L wrote: > For the following example, the output may be any of "1 7 2", "1 8 2" and "1 9 2"? The output is "1 1 2" due to LTR evaluation order mandated by the specs: https://play.golang.org/p/WorzfBzfOhe -- -j -- You received this message because you are s

[go-nuts] Re: About argument evaluation order.

2018-03-20 Thread T L
On Tuesday, March 20, 2018 at 11:45:02 AM UTC-4, T L wrote: > > The Go specification only says > > In a function call, the function value and arguments are evaluated in the > usual order . > > The usual order is explained here: > https://tip.

[go-nuts] Re: About argument evaluation order.

2018-03-20 Thread T L
BTW, another problem: are the function calls appearing in a composite literal evaluated by their lexical left-to-right order? On Tuesday, March 20, 2018 at 11:45:02 AM UTC-4, T L wrote: > > The Go specification only says > > In a function call, the function value and arguments are evaluated in