diff --git a/doc/go_spec.html b/doc/go_spec.html index 1eb6c7a588..2e5aa626c5 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -26,8 +26,6 @@ Todo's: [ ] cleanup: 6g allows: interface { f F } where F is a function type. fine, but then we should also allow: func f F {}, where F is a function type. [ ] decide if and what to write about evaluation order of tuple assignments -[ ] decide if and what to write about evaluation order of composite literal - elements (single expressions, (key:value) pairs) Wish list: [ ] enum facility (enum symbols that are not mixable with ints) or some other @@ -126,6 +124,8 @@ Closed: a for loop that is following, and can break L be used inside it? [x] there is some funniness regarding ';' and empty statements and label decls [x] cleanup convert() vs T() vs x.(T) - convert() should go away? +[x] decide if and what to write about evaluation order of composite literal + elements (single expressions, (key:value) pairs) --> @@ -162,7 +162,7 @@ Expression = Alternative { "|" Alternative } . Alternative = Term { Term } . Term = production_name | token [ "..." token ] | Group | Option | Repetition . Group = "(" Expression ")" . -Option = "[" Expression ")" . +Option = "[" Expression "]" . Repetition = "{" Expression "}" . @@ -2983,6 +2983,33 @@ Also it may be possible to make typed constants more like variables, at the cost overflow etc. errors being caught.
++When evaluating the elements of an assignment or expression, +all function calls, method calls and +communication operations are evaluated in lexical left-to-right +order. Otherwise, the order of evaluation is unspecified. +
+ +
+For example, while evaluating the arguments for this call
+to function f
,
+
+f(g(), h() + x[i()], <-c) ++
+the call to g()
happens before the call to h()
,
+which happens before the call to i()
, all of
+of which happen before receiving the value from the channel
+c
.
+However, the order of those events compared to the evaluation of
+f
, the evaluation of x
, and the indexing
+of x
by the return value of
+i()
is not specified.
+