Lambda the Ultimate

inactiveTopic Evaluation Order Semantics in Expressions with Side Effects
started 9/15/2002; 8:00:49 AM - last post 9/17/2002; 7:34:16 AM
jon fernquest - Evaluation Order Semantics in Expressions with Side Effects  blueArrow
9/15/2002; 8:00:49 AM (reads: 1837, responses: 3)
Evaluation Order Semantics in Expressions with Side Effects
The paper is a "step towards a complete and accurate denotational description of ANSI C." "ELSE", a simple eager expression language with side effects and a subset of ANSI C expressions, is introduced to explore "the denotational semantics of evaluation order." Monads and monad transformers are used to modularly introduce variations in evaluation order.

Several evaluation orders for "+" are implemented in Haskell: left-to-right evaluation (Java, ML), non-deterministic choice, interleaving, evaluation in one atomic step, and evaluation with ANSI C control points which have a margin of semantic ambiguity to implement optimizations in. (A Study of Evaluation Order Semantics in Expressions with Side Effects, NIKOLAOS S. PAPASPYROU, DRAGON MACOS, 2000)
Posted to implementation by jon fernquest on 9/15/02; 8:10:08 AM

Ehud Lamm - Re: Evaluation Order Semantics in Expressions with Side Effects  blueArrow
9/16/2002; 1:32:16 PM (reads: 695, responses: 0)
It is interesting to see how different language designers decided to define the order of evaluation of boolean expressions. Unspecified (most languages), short-circut (C), support for both short and long circut evaluation (Ada. When the non-short circut operators are used, the order of evaluation of the operands is unspecified).

pixel - Re: Evaluation Order Semantics in Expressions with Side Effects  blueArrow
9/17/2002; 5:57:32 AM (reads: 689, responses: 1)
Unspecified (most languages), short-circut (C), support for both short and long circut evaluation

AFAIK short-circuit has won the game. It is the default for C, C#, Java, JavaScript, OCaml, Haskell, Python, Perl...

more about it

Ehud Lamm - Re: Evaluation Order Semantics in Expressions with Side Effects  blueArrow
9/17/2002; 7:34:16 AM (reads: 718, responses: 0)
Vox populi vox dei? Come on!

When it comes to programming languages, popularity can be very misleading, as we all know.

Anyway, short circut doesn't go to well with operator overloading, so languages that support both often help you shoot yourself in the foot.

By the way, I wouldn't have included Haskell in the list you gave, seeing as it is uniformly lazy, and doesn't only short circut boolean expressions.