Paul Schlie wrote:
From: Dave Korn <[EMAIL PROTECTED]>
----Original Message----

From: Paul Schlie
Sent: 08 June 2005



- Can you give an example of an operation which may yield an undefined
 non-deterministic result which is reliably useful for anything?

 Random number generation?

randomness has nothing whatever to do with non-determinisn. They
are completely different concepts.

But there are of course many examples.

THere are many examples in concurrent programming where non-determinism
is useful, and in set programming, arbitrary non-deterministic selection
from a set is fundamental.

But this is a complete red herring in this discussion

The reason that for example in Ada we say that
a+b means non-determinisitically either compute a then b, or
b then a, is not that it is useful for these results to be
different, but precisely because we expect NO reasonable
program to ever write an expression a+b in which the two
semantic meanings that are possible are different, and
we want the compiler to take advantage of this to generate
better code.

For example

  a + f(b)

we typically expect f(b) to be called first, even though
formally it might be the case that f(b) modifies a, so
this choice could have some effect from the formal
non-determinism of the semantics. Our actual attitude
is that if anyone writes code like this in which f(b)
modifies a, they are highly incompetent and we don't
care what happens.


Reply via email to