hasan@eclipse.stanford.edu (Waqar Hasan) (03/01/91)
I am new to Scheme and my source of information is the R^3 report on Scheme. I am considering using the primitive expressions of Scheme as part of a database language. The language is an interface language to a data server running on a multi-processor machine. I would like to seek clarification on the semantics of procedure calls. The report states that arguments to a procedure are evaluated in an "indeterminate order". Does this mean any particular evaluation should be equivalent to some serial order or are there no restrictions? Example: Consider (f (+ e1 e2) (+ e3 e4)) The order of evaluation e3, e4, e1, e2 is a serialization since it corresponds to evaluating the second argument and then the first argument. The order e1, e3, e4, e2 on the other hand is not (in general) equivalent to to any serial evaluation of the arguments. The phrase "indeterminate order" seems to suggest that a corresponding serial order is required. Is that the case? Should that be the case? -Waqar Hasan hasan@hplabs.hp.com, 415-857-4233
xjam@cork.Berkeley.EDU (Brian F. Dennis) (03/01/91)
In article <1991Feb28.230440.1762@Neon.Stanford.EDU>, hasan@eclipse.stanford.edu (Waqar Hasan) writes: |> I am new to Scheme and my source of information is the R^3 report on Scheme. |> [stuff deleted] |> I would like to seek clarification on the semantics of procedure calls. |> The report states that arguments to a procedure are evaluated in an |> "indeterminate order". |> |> Does this mean any particular evaluation should be equivalent to some |> serial order or are there no restrictions? |> |> Example: Consider (f (+ e1 e2) (+ e3 e4)) |> The order of evaluation e3, e4, e1, e2 is a serialization |> since it corresponds to evaluating the second argument and then the |> first argument. |> The order e1, e3, e4, e2 on the other hand is not (in general) equivalent to |> to any serial evaluation of the arguments. The problem is that e1, e3, e4, and e2 are NOT arguments of f. The expressions (+ e1 e2) and (+ e3 e4) are the arguments to f. Those expressions will be evaluated in an indeterminate order, corresponding to your first statement, which is the correct interpretation. Similarly, within in each plus call, the arguments will be evaluated in an indeterminate order. |> -Waqar Hasan |> hasan@hplabs.hp.com, 415-857-4233 They can't come on and play me in prime time, |Crossjammer ...... OUT! Cause I know the time, cause I'm gettin' mine. |xjam@yew.berkeley.edu I get on the mix late in the night... <-------------------PUBLIC ENEMY
hasan@hplabsz.HP.COM (Waqar Hasan) (03/05/91)
Thanks for the folks who replied to my question: Is the evaluation of arguments to a procedure (a) allowed to be concurrent (b) required to correspond to some serial order (b) is the correct official answer. Can someone tell me why such a requirement makes sense? Wasnt Scheme supposed to support concurrent evaluation? Is there any work/papers which show why (b) is preferable over (a)? Interestingly, I got two replies which clarified that the language requires (b) and one reply which suggested that (a) made more sense. I also got hold of a draft of the Scheme standard (P1178/D4) which clarifies the semantics to be (b). -Waqar hasan@hplabs.hp.com